diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-09-15 17:27:02 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-09-15 17:27:02 +0200 |
commit | e68446e0a8a4a54b99ba5773a9f7ff17837a393b (patch) | |
tree | d35410d8a0d4e3ea00de8cad8f671ce5f5e5bbbe /src/mint-lib/mint_api_context.c | |
parent | 1b0f8609901eb8184194144cc20a194534c81a4a (diff) | |
download | exchange-e68446e0a8a4a54b99ba5773a9f7ff17837a393b.tar.gz exchange-e68446e0a8a4a54b99ba5773a9f7ff17837a393b.tar.bz2 exchange-e68446e0a8a4a54b99ba5773a9f7ff17837a393b.zip |
adding tests for /wire
Diffstat (limited to 'src/mint-lib/mint_api_context.c')
-rw-r--r-- | src/mint-lib/mint_api_context.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mint-lib/mint_api_context.c b/src/mint-lib/mint_api_context.c index 9beeef149..5a14b4a46 100644 --- a/src/mint-lib/mint_api_context.c +++ b/src/mint-lib/mint_api_context.c @@ -435,6 +435,29 @@ MAC_download_get_result (struct MAC_DownloadBuffer *db, { json_t *json; json_error_t error; + char *ct; + + if ( (CURLE_OK != + curl_easy_getinfo (eh, + CURLINFO_CONTENT_TYPE, + &ct)) || + (NULL == ct) || + (0 != strcasecmp (ct, + "application/json")) ) + { + /* No content type or explicitly not JSON, refuse to parse + (but keep response code) */ + if (CURLE_OK != + curl_easy_getinfo (eh, + CURLINFO_RESPONSE_CODE, + response_code)) + { + /* unexpected error... */ + GNUNET_break (0); + *response_code = 0; + } + return NULL; + } json = NULL; if (0 == db->eno) |