Skip to content

Commit

Permalink
Fix the RESTful keyring add/set http_status_message
Browse files Browse the repository at this point in the history
For successful requests (200), was being returned as "application/json",
but should be "OK".
  • Loading branch information
quixotique committed Nov 7, 2016
1 parent 24266b5 commit e47d0ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions keyring_restful.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static int http_request_keyring_response(struct httpd_request *r, uint16_t resul
return result;
}

static int http_request_keyring_response_identity(struct httpd_request *r, uint16_t result, const char *message, const keyring_identity *id)
static int http_request_keyring_response_identity(struct httpd_request *r, uint16_t result, const keyring_identity *id)
{
const char *did = NULL;
const char *name = NULL;
Expand Down Expand Up @@ -121,7 +121,7 @@ static int http_request_keyring_response_identity(struct httpd_request *r, uint1
}
r->http.response.result_extra[0].label = "identity";
r->http.response.result_extra[0].value = json_id;
return http_request_keyring_response(r, result, message);
return http_request_keyring_response(r, result, NULL);
}

static HTTP_CONTENT_GENERATOR restful_keyring_identitylist_json_content;
Expand Down Expand Up @@ -228,7 +228,7 @@ static int restful_keyring_add(httpd_request *r, const char *remainder)
}
if (keyring_commit(keyring) == -1)
return http_request_keyring_response(r, 500, "Could not store new identity");
return http_request_keyring_response_identity(r, 200, CONTENT_TYPE_JSON, id);
return http_request_keyring_response_identity(r, 200, id);
}

static int restful_keyring_set(httpd_request *r, const char *remainder)
Expand All @@ -247,5 +247,5 @@ static int restful_keyring_set(httpd_request *r, const char *remainder)
return http_request_keyring_response(r, 500, "Could not set identity DID/Name");
if (keyring_commit(keyring) == -1)
return http_request_keyring_response(r, 500, "Could not store new identity");
return http_request_keyring_response_identity(r, 200, CONTENT_TYPE_JSON, id);
return http_request_keyring_response_identity(r, 200, id);
}

0 comments on commit e47d0ce

Please sign in to comment.