8000 [BUG] Error thrown when using Authorize parameter · Issue #1016 · reactiveui/refit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[BUG] Error thrown when using Authorize parameter #1016
Closed
@dansharpe83

Description

@dansharpe83

Describe the bug
I get an error when trying to do a basic post, it has an object serialized to the body and a bearer token.
my class is:
interface IDataFinitiApi { [Post("/businesses/search")] Task<DataFinitiSearchResult<BusinessRecord>> SearchCompanies([Body]DataFinitiRequest request, [Authorize("Bearer")] string token); }

my test app is this:
`var s = RestService.For("https://api.datafiniti.co/v4", settings);

        var query = new DataFinitiRequest { Query = "postalCode:ST3 2NS" };

        var result = s.SearchCompanies(query, apiKey).GetAwaiter().GetResult();`

when i go over the result line, i get the following error:
The given key '1' was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException[T](T key)
at System.Collections.Generic.Dictionary2.get_Item(TKey key) at Refit.RequestBuilderImplementation.<>c__DisplayClass18_0.<<BuildRequestFactoryForMethod>b__0>d.MoveNext() in /_/Refit/RequestBuilderImplementation.cs:line 621 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
at Refit.RequestBuilderImplementation.<>c__DisplayClass14_02.<<BuildCancellableTaskFuncForMethod>b__0>d.MoveNext() in /_/Refit/RequestBuilderImplementation.cs:line 240 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at DataFinitiPoC.Program.Main(String[] args) in DataFinitiPoC\Program.cs:line 27

i think is is because in the RequestBuilderImplementation.cs, on line 618, is adds the bearer token, but doesnt mark it as mapped, so it falls into the loop underneath, which is where the error occurrs.

this is a netcore console app, using v6.0.0-preview.37 of refit

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0