Open ansman opened 5 years ago
Same for the http method here. I was wondering many hours about my bug until i find out, i can not overwrite the default method even if i specify. I would be nice to change the name or to implement something, that a request can overwrite default values.
@e5l, what's the status of this one? Can we update the documentation/naming of the feature to RequestOverride
if the behaviour is not providing default value but overriding values set by the user?
I tried to set the default scheme and host like this:
defaultRequest {
url(scheme = "https", host = "127.0.0.1")
}
But this means that the default path is now always "/" and I cannot override it in a request. This defaultRequest feature is pretty useless like this :(
My suspicion is that is has something to do with the HttpRequestData
being immutable. Maybe once it is set any following request cannot change it anymore?
What do you think @e5l ?
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Ktor Version
1.1.1
Ktor Engine Used(client or server and name)
N/A
JVM Version, Operating System and Relevant Context
N/A
Feedback
When using the
DefaultRequest
feature it prevents the caller being able to specify its own values.For example if you do this:
all requests will always be against the host
example.com
even if a user does this:If anything the name of the feature is misleading and should perhaps be called
AllRequests
instead.This is especially hard since a lot of properties in
Url
have default values of their own so it's hard to know if they have been set explicitly or not.