Allow leaving encoded slash in UrlSegmentParameter value #2265
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
We need to use path parameters which include the sequence of characters '%2F' or '%2f' in them. The constructor of UrlSegmentParameter replaces these sequences in the value with a '/' character. When using version 110.2.0 of RestSharp we would get around this by setting the Value property with the original string after the creation of the UrlSegmentParameter, but at 112.0.0 this is no longer possible as the Value property is now readonly after creation.
This pull request adds an optional parameter to the UrlSegmentParameter constructor to give control over whether the value is changed to replace '%2F' or not.
(we cannot create a new class with the desired behaviour since the UrlSegmentParameter type is used in this line https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Request/UriExtensions.cs#L57)
Purpose
This pull request is a:
Checklist