This issue is not strictly related to the scrapegraph-js library.
Description
I have noticed a discrepancy between the documentation and the server responses, specifically regarding the HTTP response code when the API key is invalid or missing.
According to the API Reference at Error Handling page, if the key is invalid or missing, the server should return a 401 Unauthorized error. However, it always returns a 403 Forbidden error instead.
For example, here I am using an invalid key:
And in this example, I am not including the key in the request header:
In both cases, it returns 403.
In this repo (scrapegraph-js)
Specifically for this repository, the HTTP error mapping is wrong as a consequence.
|
function mapHttpError(status: number): string { |
This issue is not strictly related to the
scrapegraph-jslibrary.Description
I have noticed a discrepancy between the documentation and the server responses, specifically regarding the HTTP response code when the API key is invalid or missing.
According to the API Reference at Error Handling page, if the key is invalid or missing, the server should return a
401 Unauthorizederror. However, it always returns a403 Forbiddenerror instead.For example, here I am using an invalid key:
And in this example, I am not including the key in the request header:
In both cases, it returns
403.In this repo (
scrapegraph-js)Specifically for this repository, the HTTP error mapping is wrong as a consequence.
scrapegraph-js/src/scrapegraphai.ts
Line 51 in 70b75d5