-
-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leading slash broke RequestUri in HttpClient with BaseAddress #568
Comments
Could you point me to the specific code and not the whole repo? |
this is a little solution special for testing this bug =) Result: |
I understand what it is what it is but if you instead provided a minimal repro I could probably answer right now. What's happening in this test is confusing and needs to be reduced. I have no idea why you're doing a fake HTTP call to get the |
I do fake HTTP call through HttpClient cause it is correlated to HttpClient logic
Flurl 3 returns path starting with |
I meant a minimal example demonstrating the Flurl bug, but let's forget about that and go back to your original tests. Your From your test: // what is the value of requestUri here? is it what you expect? is it different than Flurl2?
Url requestUri = path1.AppendPathSegment(path2);
// you're completely done using Flurl here, so this part doesn't even matter
var actualUrl = await GetRequestUrl(baseAddress, requestUri); |
I can confirm that we have the same issue after upgrading Flurl to version 3.0.0. No code changes, and now LocalPath in BaseAddress is not respected for some reason. It is reasonable to suspect to Flurl since that is the only thing that was changed. |
Flurl 2:
Flurl 3:
|
@ch1seL Perfect, that's exactly what I was after. I didn't doubt there might be an issue lurking somewhere, it just got rather obfuscated in those tests. :) I agree that the Flurl 2 behavior is more correct and that this is a regression bug. I will get it fixed. (As a side note, if you use Flurl.Http to make your calls rather than HttpClient, it shouldn't matter.) |
Fixed & released in 3.0.1 |
Hi!
I've tried to bump Flurl and faced with broken RequestUri.
My HttpClient has BaseAddress with some relative path like
http://fake.com/api/
I compose Uri and Flurl adds leading
/
when I use AppendPathSegment for example "path1".AppendPathSegment("path2")As a result, RequestUri equals
http://fake.com/path1/path2
but expectedhttp://fake.com/api/path1/path2
See https://github.com/ch1seL/FlurlTest I reproduced it there
Could I use relative paths in BaseAddress or it is a bad practice?
The text was updated successfully, but these errors were encountered: