khoih-prog / WiFiWebServer_RTL8720

Simple WiFiWebServer, HTTP Client, MQTT and WebSocket Client library for Realtek RTL8720DN, RTL8722DM, RTM8722CSM boards using WiFi. Supporting WiFi at 2.4GHz and 5GHz
MIT License
11 stars 5 forks source link

server.hasHeader and server.header both return incorrect values? #8

Closed JokinAce closed 1 year ago

JokinAce commented 1 year ago

Describe the bug

Trying to get and check value of any Header such as APIKey is not working

Steps to Reproduce

    server.on("/test", []() {
        if (server.hasHeader("APIKey") && server.header("APIKey") == "test")
            server.send(201, "text/plain", "Good");
        else
            server.send(401, "text/plain", "false");
    });

Send a GET request with the header "APIKey" and value of "test"

Expected behavior

Getting a response with status code 201 and text "Good"

Actual behavior

Getting a response with status code 401 and text "false"

Screenshots

Firefox Network analyzer

Information

Arduino IDE 2.0.0 AmebaD core 3.1.4

khoih-prog commented 1 year ago

Hi @JokinAce

Please follow the instructions in Issue: Bug report whenever posting an issue.

Post the MRE, including RTL8720DN code, server code, etc. so that anyone can easily and quickly duplicate the so-called problem you met.

A note is that don't use Arduino IDE v2.0.0 yet, stick with v1.8.19 for now.

I'm closing the issue now, and won't reopen until all the requirements are met as well as a bug is somehow proven.


Also test using ESP32 WebServer to see if the issue persists. Post the issue there if you're sure there is a bug of that library and not in your code.