diff --git a/src/application.c b/src/application.c index 38b8de2..394d308 100644 --- a/src/application.c +++ b/src/application.c @@ -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 = { diff --git a/src/request.c b/src/request.c index bf4ab39..84313d8 100644 --- a/src/request.c +++ b/src/request.c @@ -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; }