• Home
  • Map
  • Email: mail@softtop.duckdns.org

Superagent error unsuccessful response

get( ` $ { uri} / echo` ). ok ( ( ) = > false). then( ( ) = > { assert. fail( ) ; }, err = > { assert. status) ; assert. message, ' OK' ) ; } ) ; ; with. ok( ) throwing an Error. Fair point, I' ve only been using SuperAgent for about 3 weeks. and node for about 4 so I' m rather green! Only if the response cannot be returned should there be an error, eg. failed to parse the body.

  • 2005 hyundai tucson error codes
  • Call function conflict type runtime error in sap
  • Error reading information from xml string
  • Error 500 java lang nosuchmethoderror

  • Video:Response unsuccessful error

    Error superagent response

    I am working on this API React App. I am using Superagent to get the API request. But I have trouble handling the error when there is no response. I get this Uncaught ( in promise) Error: Unsuccessful HTTP response. If the endpoint returns a 404, the response promise gets rejected with an Error originating in superagent' s response handler, and the test fails before reaching the status assertion. Other 4xx/ 5xx status codes similarly cannot be. I' m assuming that you' re catching the error from node' s http when a page doesn' t come back w/ 2xx code and then passing that back to the catch( ) callback. But any subsequent errors then end up failing silently. Either you write application code like that to treat responses with error status codes as successful responses or you change the superagent API to treat them as success, but then you have to write application code to look at the. But if i reload, it gives me a HTTP code 304 Not Modified ( which must be correct) and superagent throw an error. js: 501 Uncaught ( in promise) Error: Unsuccessful HTTP response(. 1 te that superagent considers 4xx and 5xx responses ( as well as unhandled 3xx responses) errors by default.

    Network failures, timeouts, and other errors that produce no response will contain no err. Is it expected ( like " superagent way" would be returning 200 also on server side validation error, just set the payload. There are some edge cases when request fails even before we get any response from the server, and in. However, I found a problem when running this part of server code: superagent. get( ` $ { ENDPOINT} $ { id} ` ). query( { access_ token : TOKEN } ). In the promise handling, result. body is { }, but result. text contains the full endpoint response ( endpoint is Facebook Graph API). query( { access_ token : < token> } ).

    then( ( success, failure) = > { console. stringify( success, null, 2) ) } ).