Closed phamhieu closed 4 years ago
can you give me a sample of how to call Rpc method?
var res = await postgrest.rpc('get_status', {'username': 'supabot'}).end();
This gives 500 error as below
{body: null, status: 500, statusCode: StateError, statusText: Bad state: Cannot set the body fields of a Request with content-type "application/json".}
@asaravindkumar good catch!
I pushed a fix for this. In short, dart:http
requires body to be a json encoded string.
Just a head up @asaravindkumar, this task is depended on #7 because the PR will convert return data into a PostgrestResponse
obj instead of raw Map
obj
@phamhieu yes. I can work on this one. thanks
Thanks @phamhieu.
How would you want to treat errors from tests? shall I post here? or comment the expect part for now with a TODO?
For e.g., statusText is now string, so unable to get the error code.
statusText: {"hint":null,"details":null,"code":"42P01","message":"relation \"public.missing_table\" does not exist"}
can you get error code from error
variable?
This is a Hacktoberfest task! You can read more about Hacktoberfest on our blog and see all tasks on our Hacktoberfest Project Board.
Summary
We need help with completing test coverage for this library. Following postgrest-js there are 4 test files:
Right now, there's only 1 test per file as example. We need to have all test cases as original
postgrest-js
project.https://github.com/supabase/postgrest-js/blob/master/test/basic.test.ts https://github.com/supabase/postgrest-js/blob/master/test/filters.test.ts https://github.com/supabase/postgrest-js/blob/master/test/resource-embedding.test.ts https://github.com/supabase/postgrest-js/blob/master/test/transforms.test.ts
Details
Before running test file, It's required to start a docker instance first:
cd test/db
make start