Skip to content

Remove usage of Arduino constant emptyString and use our own instead#417

Open
mathieucarbou wants to merge 2 commits intomainfrom
emptyString
Open

Remove usage of Arduino constant emptyString and use our own instead#417
mathieucarbou wants to merge 2 commits intomainfrom
emptyString

Conversation

@mathieucarbou
Copy link
Copy Markdown
Member

@mathieucarbou mathieucarbou commented Apr 3, 2026

This PR is a cleanup in order to use our own empty string constant instead of Arduino one.

This will also help support HOST as done in PR #416

@mathieucarbou
Copy link
Copy Markdown
Member Author

@MitchBradley FYI

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces uses of the Arduino emptyString constant with a project-owned asyncsrv::empty constant.

Changes:

  • Updated default arguments across response/request APIs to use asyncsrv::empty.
  • Replaced emptyString assignments/returns throughout request parsing and authentication helpers.
  • Updated examples to return/assign asyncsrv::empty instead of emptyString.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/WebResponseImpl.h Switches AsyncBasicResponse String overload default arg to asyncsrv::empty.
src/WebRequest.cpp Replaces emptyString in parsing/temp fields and several const String& return paths.
src/WebHandlers.cpp Updates AsyncFileResponse content-type default argument usage.
src/WebAuthentication.cpp Uses asyncsrv::empty for early-return empty String values on errors.
src/ESPAsyncWebServer.h Updates multiple overload defaults and const String& accessors to use asyncsrv::empty.
src/AsyncEventSource.cpp Returns asyncsrv::empty on allocation failure.
examples/Templates/Templates.ino Updates template processor “no value” return to asyncsrv::empty.
examples/RequestContinuation/RequestContinuation.ino Clears message using asyncsrv::empty.
examples/ChunkRetryResponse/ChunkRetryResponse.ino Clears trigger string using asyncsrv::empty.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@MitchBradley
Copy link
Copy Markdown

@mathieucarbou Thanks for addressing this. After it is merged, should I close #416 and submit a revised version, after addressing copilot's concerns?

@mathieucarbou-ibm
Copy link
Copy Markdown

@mathieucarbou Thanks for addressing this. After it is merged, should I close #416 and submit a revised version, after addressing copilot's concerns?

You just need to rebase your HOST PR on top of branch emptyString instead of main.

Also please do not forget to open a separate PR for the state machine refactoring. This one is more requires more review and testing.

Thank you very much for these !

@MitchBradley
Copy link
Copy Markdown

One thing that occurred to me is that instead of #if defined(ESP32) || defined(HOST}, it might be better to create a new macro with a name like MULTICORE, so one could write #ifdef MULTICORE and put the "ESP32 || HOST" logic in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants