-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
From @PawelTroka on Sunday, November 12, 2017 5:11:23 AM
Basically this issue is kind of similar to #912, except it's about plus sign ('+') and this time it does not only affects TestHost but shows up also when hosted.
It does not work correctly on TestHost or when hosted and invoked through web browser or any web client for that matter.
It is failing my integration tests where I am using Microsoft.AspNetCore.TestHost v2.0.0 and Microsoft.AspNetCore.WebUtilities v2.0.0. Please notice that my WebApi and WebApi.IntegrationTests are AspNetCore 2.0 but are targeting net461 (due to some of my libraries not yet ported).
Repro:
Unit test:
https://github.com/PawelTroka/Computator.NET/blob/97b666341bf8a9b21fb9dc59f94528ccf830a931/Computator.NET.WebApi.IntegrationTests/CalculateApiTests.cs#L42
Goes through route:
real/{equation}/{x} from method:
https://github.com/PawelTroka/Computator.NET/blob/97b666341bf8a9b21fb9dc59f94528ccf830a931/Computator.NET.WebApi/Controllers/CalculateController.cs#L34
But because encoding plus sign makes no difference we have equation with unencoded plus sign
In images:
When run through browser:
We type encoded url

What reaches our controller however is already decoded

So when we are decoding it in another overload of Get(..) we will attempt to decode already decoded expression, which will make us replace plus sign ('+') with space (' ').
Also note that this exists at least from AspNetCore v1.1
Copied from original issue: aspnet/HttpAbstractions#964

