Refit: [BUG] CancellationToken fields put in query parameters of request

Created on 29 Aug 2019  路  4Comments  路  Source: reactiveui/refit

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

bug

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.

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tstivers1990 picture tstivers1990  路  5Comments

Mike-E-angelo picture Mike-E-angelo  路  6Comments

omares picture omares  路  6Comments

ColKrumpler picture ColKrumpler  路  3Comments

jstafford5380 picture jstafford5380  路  4Comments