Comments (11)
You should write https://example.com/api/
for baseUrl
.
from dio.
You should write
https://example.com/api/
forbaseUrl
.
The frontend does not necessarily know the full path.
It's not clear to me, why using a relative path isn't allowed.
from dio.
How do the instance be able to make requests if the full path is unavailable?
from dio.
Web applications can request the same origin using relative paths.
Take a look at a W3Schools reference
They also suggest to use relative paths when possible
from dio.
Dio won't know your origin unless you define so. It's not a Web application.
Closing as intended and won't fix.
from dio.
Not so sure, this may actually be a valid request for Flutter Web platform.
from dio.
The problem is not that Dio doesn't know something, but it just stops users from using relative paths with an assert.
You cannot as that it is not a web app, because Dio can indeed be used as a client in a web application.
As for me, it's quite strange to forbid the usage of something that is a part of the specification for no reason, especially when the actual request functionality works and the problem is in an unnecessary assert statement.
Or is there a reason why it is forbidden?
from dio.
Not so sure, this may actually be a valid request for Flutter Web platform.
It could be possible to resolve by Uri.base.resolve(path)
specifically on Web.
https://api.flutter.dev/flutter/dart-core/Uri/base.html
However, it's also available when you're setting the baseUrl
.
from dio.
Yes, if you look at the initial issue, it is possible to bypass the assert using the setter for baseUrl after the BaseOptions is created.
But if it's so, why the asset is there in the first place?
from dio.
You cannot as that it is not a web app, because Dio can indeed be used as a client in a web application.
I have the opposite opinion here. Dio is not in any form, an application. As you declared, it can only be used in a Web application.
As for me, it's quite strange to forbid the usage of something that is a part of the specification for no reason, especially when the actual request functionality works and the problem is in an unnecessary assert statement.
Could you provide a reproducible example that it can run without the assertion?
But if it's so, why the asset is there in the first place?
You can use the blame view to determine when it's been introduced to find out the cause.
from dio.
Could you provide a reproducible example that it can run without the assertion?
I created a repo with the minimal reproducible example of both the exception and the supposed behaviour. Its README describes the steps to reproduce both situations.
You can use the blame view to determine when it's been introduced to find out the cause.
diox/#18 has an issue of #1373 connected, but it's still unclear why baseUrl
must include the host in the first place.
from dio.
Related Issues (20)
- Running Gradle task 'assembleProfile'.. ../../../.pub-cache/hosted/pub.dev/dio-5.4.3/lib/src/ form_data.dart:175:54: Error: The argument type 'List <int>' can't be assigned to the parameter type 'Uint8list'. HOT 1
- Improve Exception Detailing for Dio HOT 1
- Improve Exception Detailing for Dio Package HOT 1
- SocketException: Connection reset by peer (OS Error: Connection reset by peer, errno = 104), address = XXXX, port = 49440 HOT 2
- Docs for merging between `Options` and `BaseOptions` are not clear HOT 12
- Cookie manager path match error HOT 1
- When using Dio in a web environment, there needs to be a way to disable Dioβs automatic cookie setting HOT 8
- Prompt for not simple requests on Web HOT 2
- DioException response.data is null HOT 1
- [native_dio_adapter] Windows build breaks when adding package HOT 1
- DioException (DioException [connection error]: The connection errored: Connection reset by peer This indicates an error which most likely cannot be solved by the library. HOT 3
- Add privacy manifest file for iOS HOT 1
- incorrect formatting when parsing `multipart` form data using `FormData.fromMap()` causes `NullReferenceException` in .NET backend HOT 2
- I can't return my own errors class in onError interceptor HOT 1
- RFC - Custom DNS Resolver HOT 2
- I can't use MediaType when I create MultipartFile HOT 1
- Update for wasm HOT 1
- Implement automatic redirects for requests regardless of the `HttpClient` HOT 1
- Migrating browser_adapter.dart for WASM HOT 2
- Remove the message 'The request was manually cancelled by the user.' for canceltoken.cancel() 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 dio.