Steps To Reproduce
Create a refit interface similar to the following:
[Get("/api/event/getregistered")]
Task<ApiResponse<RegisteredEventsResponse>> GetRegisteredEventsAsync(SubmitRequest submitRequest, CancellationToken? cancellationToken = null);
Capture the http get request and see the following:
{Method: GET, RequestUri: '.../getregistered?ApiVersion=2.1&FundraisingPlatform=1&DeviceId=blah&IsCancellationRequested=False&CanBeCanceled=True&WaitHandle.SafeWaitHandle.IsInvalid=False&WaitHandle.SafeWaitHandle.IsClosed=False',
Note that the following query parameters are not expected:
&IsCancellationRequested=False&CanBeCanceled=True&WaitHandle.SafeWaitHandle.IsInvalid=False&WaitHandle.SafeWaitHandle.IsClosed=False
Expected behavior
Only the following query parameters are expected:
ApiVersion=2.1&FundraisingPlatform=1&DeviceId=blah
Query Parameters related to or CancellationToken? should be ignored.
Note that CancellationToken is properly ignored, but nullable type CancellationToken? is not ignored.
Environment
https://www.nuget.org/packages/refit/4.7.51
IPhone 7
IOS OS 12.4
Not saying it isn麓t a bug.
But the following
[Get("/api/event/getregistered")]
Task<ApiResponse<RegisteredEventsResponse>> GetRegisteredEventsAsync(
SubmitRequest submitRequest,
CancellationToken cancellationToken = default);
works as expected
Did a little further investigation, and now see that CancellationToken is in fact handled properly and ignored from a query params perspective, however CancellationToken? is not handled properly.
I've edited the bug description to to properly describe this.
I'll pick this up.
Closing due to age. Please try Refit v6 and reopen if still an issue.
Most helpful comment
Did a little further investigation, and now see that CancellationToken is in fact handled properly and ignored from a query params perspective, however CancellationToken? is not handled properly.
I've edited the bug description to to properly describe this.