Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Handle xhtml Request #1232

Open
miloit opened this issue Nov 11, 2022 · 1 comment
Open

Handle xhtml Request #1232

miloit opened this issue Nov 11, 2022 · 1 comment
Labels

Comments

@miloit
Copy link

miloit commented Nov 11, 2022

Hello,
I tried to do a xhtml request

<script type="text/javascript">
    function test() {
	  var xhttp = new XMLHttpRequest();
          var devicename="";
          var j = {
            "first_name":"binchen",
            "last_name":"heris",
        };
	  xhttp.onreadystatechange = function() {
	    if (this.readyState == 4 && this.status == 200) {
		
			    } else {
	    console.log("unexpected response status " + this.status);
	    }
	  };
	  xhttp.open("GET", "/config", true);
	  xhttp.send(JSON.stringify(j));
	}

Here is my esp code

webServer.onRequestBody([](AsyncWebServerRequest * request, uint8_t *data, size_t len, size_t index, size_t total) {
    Serial.println("Running");
    if (request->url() == "/config") {
      
      request->send(200, "text/plain", "end");
    }
  });

But this is not working at all...any hints?

Sveninndh added a commit to Sveninndh/ESPAsyncWebServer that referenced this issue Jan 3, 2023
…dev#1249)

AsyncAbstractResponse::_fillBufferAndProcessTemplates()

1.) A parameter is enclosed by the % delimiter.
2.) Parameter names can have a maximum of 32 characters.
3.) Parameter names cannot contain illegal characters. (\ .:<>{}',;"/)

A parameter is only recognized and replaced if all of these conditions are met.
Otherwise the text source code is not changed. Using double % is no longer necessary.
Nevertheless, this mechanism will continue to be supported for reasons of compatibility.
@stale
Copy link

stale bot commented May 22, 2023

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant