esp-idf/examples/protocols/http2_request
David Cermak e99490a0dd CI: Fix example test for http_request
Test is based on a public http server which might not be always
available, so the example test checks if it's available
so the test could be (by)passed if the public server not available.

But we didn't correctly check if a socket/timeout exception occurs
when trying to connect
2021-11-04 17:02:36 +01:00
..
components/sh2lib http2_request/sh2lib: Modified the "sh2lib_connect" API to take in a new 2021-04-09 10:24:15 +00:00
main Updated the root certificate of https examples 2021-10-01 13:02:48 +05:30
CMakeLists.txt [examples]: removed hyphens 2021-10-09 13:58:24 +08:00
example_test.py CI: Fix example test for http_request 2021-11-04 17:02:36 +01:00
Makefile Whitespace: Automated whitespace fixes (large commit) 2020-11-11 07:36:35 +00:00
README.md docs: Updated protocols/http* examples READMEs 2021-09-13 09:55:19 +05:30
sdkconfig.ci http2_request_example: Added example test 2021-03-16 09:55:01 +05:30

HTTP/2 Request Example

Established HTTP/2 connection with https://http2.golang.org

  • Performs a GET on /clockstream
  • Performs a PUT on /ECHO

How to use example

Before project configuration and build, be sure to set the correct chip target using idf.py set-target <chip_name>.

Hardware Required

  • A development board with ESP32/ESP32-S2/ESP32-C3 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.)
  • A USB cable for power supply and programming

Configure the project

idf.py menuconfig

Open the project configuration menu (idf.py menuconfig) to configure Wi-Fi or Ethernet. See "Establishing Wi-Fi or Ethernet Connection" section in examples/protocols/README.md for more details.

Build and Flash

Build the project and flash it to the board, then run monitor tool to view serial output:

idf.py -p PORT flash monitor

(Replace PORT with the name of the serial port to use.)

(To exit the serial monitor, type Ctrl-].)

See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.

Example Output

I (9637) example_connect: - IPv4 address: 192.168.194.219
I (9637) example_connect: - IPv6 address: fe80:0000:0000:0000:266f:28ff:fe80:2c74, type: ESP_IP6_ADDR_IS_LINK_LOCAL
Connecting to server
Connection done
[data-prvd] Sending 11 bytes
[echo-response] HELLO WORLD
[echo-response] Frame fully received
[echo-response] Frame fully received
[echo-response] Stream Closed
[get-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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2021-09-07 08:22:10.73175944 +0000 UTC m=+530259.401042400

[get-response] Frame fully received
[get-response] 2021-09-07 08:22:11.73205314 +0000 UTC m=+530260.401336111

[get-response] Frame fully received
[get-response] 2021-09-07 08:22:12.7320106 +0000 UTC m=+530261.401293569

[get-response] Frame fully received
[get-response] 2021-09-07 08:22:13.732013218 +0000 UTC m=+530262.401296183