Skip to content

Commit f943ec0

Browse files
tokangasnordicjm
authored andcommitted
lib: location: Make HTTP status visible when REST recv buf is too small
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 <[email protected]>
1 parent 1ced2a3 commit f943ec0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/location/cloud_service/cloud_service_here_rest.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,18 +500,20 @@ int cloud_service_here_rest_pos_get(
500500
req_ctx.body = body;
501501

502502
err = rest_client_request(&req_ctx, &resp_ctx);
503-
if (err) {
504-
LOG_ERR("Error from rest client lib, err: %d", err);
505-
goto end;
506-
}
507503

508-
if (resp_ctx.http_status_code != REST_CLIENT_HTTP_STATUS_OK) {
504+
if (resp_ctx.http_status_code != 0 &&
505+
resp_ctx.http_status_code != REST_CLIENT_HTTP_STATUS_OK) {
509506
LOG_ERR("HTTP status: %d", resp_ctx.http_status_code);
510507
/* Let it fail in parsing */
511508
}
512509

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

512+
if (err) {
513+
LOG_ERR("Error from rest client lib, err: %d", err);
514+
goto end;
515+
}
516+
515517
err = cloud_service_here_rest_parse_response(resp_ctx.response, location);
516518
if (err) {
517519
LOG_ERR("Failed to parse HTTP response");

0 commit comments

Comments
 (0)