You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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); }
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
The text was updated successfully, but these errors were encountered:
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);
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.Dictionary
2.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.ConfiguredTaskAwaitable
1.ConfiguredTaskAwaiter.GetResult()at Refit.RequestBuilderImplementation.<>c__DisplayClass14_0
2.<<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.TaskAwaiter
1.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
The text was updated successfully, but these errors were encountered: