supabase-community / postgrest-csharp

A C# Client library for Postgrest
https://supabase-community.github.io/postgrest-csharp/api/Postgrest.html
MIT License
118 stars 25 forks source link

Range request not working #8

Closed elrhomariyounes closed 4 years ago

elrhomariyounes commented 4 years ago

Bug report

Describe the bug

Hello, while trying to perform a Range request an exception is thrown as described in the StackTrace below

StackTrace" at 
System.Net.Http.Headers.HttpHeaderParser.ParseValue(String value, Object storeValue, Int32& index)\r\n   at
System.Net.Http.Headers.HttpHeaders.ParseAndAddValue(HeaderDescriptor descriptor, HeaderStoreItemInfo info, String value)\r\n   at System.Net.Http.Headers.HttpHeaders.Add(String name, String value)\r\n   at 
Postgrest.Helpers.<MakeRequest>d__5.MoveNext() 

After debugging I found that issue is when performing a Range request with from parameter only or both from and to the headers expected by Postgrest are :

The second header will throw the exception when trying to add it to the HttpRequestMessage.Headers because is not a valid one Exception line

To Reproduce

  1. Perform a Range request
    var response = await client.Builder<User>().Range(2).Get();

Expected behavior

System information

-OS: [Windows 10 Pro 1909] -.Net core 3.1.x -Visual Studio 16.8 -Version of supabase-postgrest-csharp: master branch of current repo

acupofjose commented 4 years ago

@elrhomariyounes - thank you for all your hard work on these bug reports! Would you be interested in being a contributor on this Repo?

elrhomariyounes commented 4 years ago

Hi, always a pleasure to contribute. Sure thank you very much @acupofjose