Commit 1f486a1
authored
Fix failure on REST requests with $filter and $orderby parameters (#3664)
## Why make this change?
- Fix issue #3662
This issue is caused by a regression in PR
#3080
The regression is that we start using the raw encoded URL and we assume
that the `$` character is not encoded when using the
`ExtractRawQueryParameter` function, this is half true, since depending
on where the URL comes from it will encode it or it will treat it as a
special character and leave it as it is.
This means the function looks for the `$filter` or `$orderby` when the
URL has the possibility to change them to `%24filter` or `%24orderby`
which causes the failure.
## What is this change?
This change fixes a bug that caused using `$filter` or `$orderby` in
REST. This is done by encoding the `parameterName` so that it has the
same format as the raw URL, it will only change it if it is unable to
find the original `$` character in the raw query.
## How was this tested?
- [ ] Integration Tests
- [x] Unit Tests
Added end to end test to ensure that REST requests that use `$filter`
and `$orderby` succeed for both cases where a user uses the special
character `$` or its URL encoded format `%24`.
## Sample Request(s)
http://localhost:5000/api/Book?$orderby=id desc
http://localhost:5000/api/Book?$filter=publisher_id 12341 parent bfc4f3d commit 1f486a1
2 files changed
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
321 | 322 | | |
322 | 323 | | |
323 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
324 | 331 | | |
325 | 332 | | |
326 | 333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4224 | 4224 | | |
4225 | 4225 | | |
4226 | 4226 | | |
| 4227 | + | |
| 4228 | + | |
| 4229 | + | |
| 4230 | + | |
| 4231 | + | |
| 4232 | + | |
| 4233 | + | |
| 4234 | + | |
| 4235 | + | |
| 4236 | + | |
| 4237 | + | |
| 4238 | + | |
| 4239 | + | |
| 4240 | + | |
| 4241 | + | |
| 4242 | + | |
| 4243 | + | |
| 4244 | + | |
| 4245 | + | |
| 4246 | + | |
| 4247 | + | |
| 4248 | + | |
| 4249 | + | |
| 4250 | + | |
| 4251 | + | |
| 4252 | + | |
| 4253 | + | |
| 4254 | + | |
| 4255 | + | |
| 4256 | + | |
| 4257 | + | |
| 4258 | + | |
| 4259 | + | |
| 4260 | + | |
| 4261 | + | |
| 4262 | + | |
| 4263 | + | |
| 4264 | + | |
| 4265 | + | |
| 4266 | + | |
| 4267 | + | |
4227 | 4268 | | |
4228 | 4269 | | |
4229 | 4270 | | |
| |||
0 commit comments