microlinkhq / open

4 stars 2 forks source link

Rest api does not tell if page does not exists (404) #29

Closed Salmela closed 4 years ago

Salmela commented 4 years ago

Bug Report

Current Behavior

Currently there is no way to detect if the link target returns non-successful HTTP status code (like 404, 401, etc.) These responses do have status: "success" which is bit misleading.

Expected behavior/code

I expect that there is some field that tells what the exact http status code was.

Additional context/Screenshots

404 page's response: https://api.microlink.io/?url=https%3A%2F%2Fwww.google.com/wufhiwef 200 page's response: https://api.microlink.io/?url=https%3A%2F%2Fwww.google.com/ This is related to #28

Kikobeats commented 4 years ago

It's expected behavior. The service gives you data, even the URL doesn't exist 🙂.

If you don't want to resolve 4xx URLs, just don't send them to the service.

You can perform a simple HTTP HEAD/GET before call the service.