espressif / esp-at

AT application for ESP32/ESP32-C2/ESP32-C3/ESP32-C6/ESP8266
Apache License 2.0
914 stars 831 forks source link

No way to get HTTP Error code #827

Open Rsaliu opened 6 months ago

Rsaliu commented 6 months ago

Answers checklist.

General issue report

I am working with esp-at.

I can successfully send a post request using:

AT+HTTPCPOST

After sending the post request, I got the following output with SEND OK which means that it is successful.

image

However, I can't get the error code. According to the document, it says to AT+HTTPCLIENT to get the error code but that always results in an error.

image

Kindly help on how to get HTTP error code after post request.

ustccw commented 6 months ago

@Rsaliu i'm sorry that AT+HTTPCPOST command does not provide a HTTP errrno after post request. it always returns the ERROR if errno > 400.
We will consider whether to add an HTTP error code in this case. As a workaround, you can catch the errno in esp_http_client_get_status_code() API, and send it by esp_at_port_write_data().

JavierReyes945 commented 3 weeks ago

We are also having this issue, even in the current master branch. It is really unconvenient to not have a way to check the return code of the HTTP transaction.

As a workaround, you can catch the errno in esp_http_client_get_status_code() API, and send it by esp_at_port_write_data()

Not sure what is the meaning of this, maybe you got confused of repository? This is ESP AT Firmware, so we only have AT commands, not C functions on ESP-IDF framework.