Skip to content

Commit

Permalink
lib: location: Make HTTP status visible when REST recv buf is too small
Browse files Browse the repository at this point in the history
With HERE cloud service, the received response in case of an error
is too large to fit into the recv buffer. However, the HTTP status is
available and should be logged.

Signed-off-by: Tommi Kangas <tommi.kangas@nordicsemi.no>
  • Loading branch information
tokangas authored and nordicjm committed May 16, 2024
1 parent 1ced2a3 commit f943ec0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/location/cloud_service/cloud_service_here_rest.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,18 +500,20 @@ int cloud_service_here_rest_pos_get(
req_ctx.body = body;

err = rest_client_request(&req_ctx, &resp_ctx);
if (err) {
LOG_ERR("Error from rest client lib, err: %d", err);
goto end;
}

if (resp_ctx.http_status_code != REST_CLIENT_HTTP_STATUS_OK) {
if (resp_ctx.http_status_code != 0 &&
resp_ctx.http_status_code != REST_CLIENT_HTTP_STATUS_OK) {
LOG_ERR("HTTP status: %d", resp_ctx.http_status_code);
/* Let it fail in parsing */
}

LOG_DBG("Received response body:\r\n%s", resp_ctx.response);

if (err) {
LOG_ERR("Error from rest client lib, err: %d", err);
goto end;
}

err = cloud_service_here_rest_parse_response(resp_ctx.response, location);
if (err) {
LOG_ERR("Failed to parse HTTP response");
Expand Down

0 comments on commit f943ec0

Please sign in to comment.