Comments (10)
This happens when I post to a URL.
var client = new http.Client();
final _body = {
"grant_type": "password",
"username": _username.text,
"password": _password.text,
};
await updateLog(_body.toString(), duration: Duration(seconds: 2));
try {
final _data = await client.post(url, body: _body, headers: {
'Content-Type': 'application/x-www-form-urlencoded',
});
await updateLog(_data.toString(), duration: Duration(seconds: 2));
} catch (e) {
await updateLog('Post Error..', duration: Duration(seconds: 1));
await updateLog(e.toString(), duration: Duration(seconds: 1));
}
returns XML.HttpRequest error.
from http.
Response code comes back null when using flutter web(browser), this is why this is happening.
from http.
Have you tried making the request with the plain HttpRequest
class? If that reproduces the error, it's not related to the http
package.
from http.
we ran into this XMLHttpRequest error when oauth token is expired. browser client is unable to capture http request 401 and return response. Instead, ClientException is thrown from http pacakge.
from http.
@david-onehub-dev Same question: what happens when you make the request with a plain HttpRequest
? And what exception is being thrown?
from http.
Hi, I'm still having this problem only when I use cross domain request.
http.get('https://api.domain.com/non-exists-path');
This will throw a XMLHttpRequest error instead of return a Response object with status code 404.
What I can do?
from http.
This looks like a known limitation in the BrowserClient (seemingly based on a known limitation in XHR):
// Unfortunately, the underlying XMLHttpRequest API doesn't expose any
// specific information about the error itself.
completer.completeError(
ClientException("XMLHttpRequest error.", request.url),
StackTrace.current);
XHR's onerror is fired for network-level errors (i.e. where there is no HTTP response code).
This might seem contrary to what you're seeing when the network tab shows 404, but for CORS error this makes sense since the browser does see the 404, but then decides to block the response from reaching the application based on the missing CORS headers.
From the application's PoV there was no 404, only network error. Hence there is only the generic "XMLHttpRequest error" to fall back on.
From a dev's perspective this is a generic network error caused by CORS, which needs to be fixed on the server side.
As for this issue I'd say this is all WAI in the context of the limitations imposed by XHR and CORS.
from http.
Gotcha. Yeah I have building Flutter apps for desktop and mobile and itβs just now when running the apps in the browser where it started breaking. Specifically logging in. So I am use firebase now as a proxy server
from http.
I'm closing this issue since the original issue hasn't been updated since 2017 and the pings since then seem to be explained by #67 (comment)
from http.
I need to test this in Browser ? Any Solution without hosting it in firebase ?
from http.
Related Issues (20)
- Cronet JNI crash in release and profile builds HOT 53
- Server received pct-encoded password HOT 3
- SecurityContext option to pin certificates HOT 5
- Initial publish of `ok_http` and firehose setup HOT 8
- JNI DETECTED ERROR IN APPLICATION: JNI ERROR (app bug): jclass is an invalid global reference: 0x25afa (deleted reference at index 4823) HOT 6
- Concerns about the usage of --dart-define in gradle scripts
- "JavaCronetEngine: using the fallback Cronet Engine implementation"
- HTTPClientError CFHTTPCookieCreateWithResponseHeaderFields
- java.lang.OutOfMemoryError: Failed to allocate a 92862520 HOT 2
- Failed to build iOS app HOT 5
- java.lang.NullPointerException: Parameter specified as non-null is null: method io.flutter.plugins.cronet_http.UrlRequestCallbackProxy.<init>, HOT 5
- Add Swift Package Manager support HOT 2
- HttpClient does not send client certificate stored in SecurityContext on iOS HOT 3
- ClientException with SocketException: Connection failed (OS Error: No route to host, errno = 65), address = 192.162.10.1, port = 2018, uri=http://192.162.10.1:2018/wiced_ota_server/ssid_chunk.html?ssid=Beah_bug&pwd=123456 HOT 1
- How can I cancel the ongoning request?
- Response has unsupport header throw exception: Failed to parse header value.message
- Usage of cupertino_http with web_socket_channel
- Converting object to an encodable object failed: Instance of 'MultipartRequest' HOT 1
- [Android 15][http]SocketException: Connection timed out (OS Error: Connection timed out, errno = 110) HOT 1
- CupertinoWebSocket: Allow close codes as defined in RFC 6455 HOT 1
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 http.