Forgot CURL request type

FossilOrigin-Name: bbc7e345745b53e36e82b0a087902abe17a850e689e31d6818604866ccc18b80
This commit is contained in:
me@ow.nekobit.net 2022-03-14 03:31:26 +00:00
parent 57703317ec
commit 1b321c8567
2 changed files with 4 additions and 7 deletions

View file

@ -138,7 +138,7 @@ int mastodont_obtain_oauth_token(mastodont_t* data,
{ _MSTDNT_QUERY_STRING, "scope", u_scope },
{ _MSTDNT_QUERY_STRING, "code", u_code },
{ _MSTDNT_QUERY_STRING, "username", u_username },
{ _MSTDNT_QUERY_STRING, "password", u_password },
{ _MSTDNT_QUERY_STRING, "password", u_password },
};
struct mastodont_request_args req_args = {

View file

@ -22,25 +22,22 @@ int mastodont_request(mastodont_t* data, struct mastodont_request_args* args)
{
int res = 0;
struct mstdnt_storage* storage = args->storage;
struct _mstdnt_query_param* params_query = args->params_query;
struct _mstdnt_query_param* params_post = args->params_post;
struct mstdnt_fetch_results results = { 0 };
char* post;
storage->needs_cleanup = 0;
if (params_post)
if (args->params_post)
{
post = _mstdnt_query_string(data, NULL, args->params_post, args->params_post_len);
curl_easy_setopt(data->curl, CURLOPT_POSTFIELDS, post);
}
if (mastodont_fetch_curl(data, args->url, &results, CURLOPT_HTTPGET) != CURLE_OK)
if (mastodont_fetch_curl(data, args->url, &results, args->request_type) != CURLE_OK)
{
return 1;
}
/* TODO Check if error json */
if (mstdnt_check_error(&results, storage))
{
res = 1;
@ -51,7 +48,7 @@ int mastodont_request(mastodont_t* data, struct mastodont_request_args* args)
cleanup:
mastodont_fetch_results_cleanup(&results);
if (params_post) free(post);
if (args->params_post) free(post);
return res;
}