Comments (5)
Hmm, okay. I've fixed up the cert and it is working but when I substitute my own API I still had the issues.
For now, I think the issue lies in that my API is not returning Access-Control-Allow-Origin: * on the header, thus it turns into a network request.
For future people who hit this issue - check your headers on the Response.
Thank you @bryanrsmith
from fetch-client.
No problem! For error responses you should see the status code in dev tools, and you should see a Response
instance in the interceptor or continuation. If you see a TypeError
or other JS error type there's probably another issue.
One other thing I noticed-- your requestError interceptor is returning the Response
instead of throwing it. That will cause the Promise returned by HttpClient.prototype.fetch()
to resolve successfully instead of rejecting. Unless your interceptor is recovering from the error you typically will want to rethrow the unsuccessful Response (or use return Promise.reject(response)
).
from fetch-client.
The httpstat.us service you're using to generate the 500 response appears to have an invalid SSL cert, so the browser is rejecting the request with a TypeError. If you visit the site using https in your browser and tell Chrome to accept the cert then the gist runs as expected.
from fetch-client.
Hi @bryanrsmith,
Thanks for replying to this issue. The same issue exists when you substitute for an API that returns a 500. I replaced the URL with our API that I know returns a 500 and I still cannot access the status key.
from fetch-client.
What output do you expect to see? Here's what I see, which is what I would expect from the code:
from fetch-client.
Related Issues (20)
- Add support for AbortSignal HOT 2
- unable to modify request header using an interceptor HOT 6
- ReadableStream uploading is not supported (Safari 11.1.1) HOT 7
- Cannot find name 'AbortSignal' HOT 5
- Converting repo to typescript HOT 5
- HTTP methods must be upper case HOT 2
- call trackRequestEnd when fetch fails HOT 8
- invalid type definition for RetryInterceptor HOT 3
- Version 1.8.0 does not work in Android Cordova App HOT 7
- version 1.8.0 generates infinite loop with retry configured to 0 HOT 2
- Version 1.8.1 "cannot find module 'aurelia-fetch-client'" HOT 3
- Is this package version number following semver? HOT 5
- config.rejectErrorResponses - lots of console warnings HOT 6
- Fetch attempts fail with TypeError on Safari 10.1 HOT 1
- Broken typings? HOT 1
- Question - json()'s benefit of converting to Blob HOT 17
- setting no-cors mode affecting content-type header behaviour
- Interceptor.responseError question HOT 5
- Fetch client doesn't like array assignment of JSON data HOT 1
- Feature request: Add aurelia-fetch-client-requests-drained event. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fetch-client.