Skip to content

Feature Request: Add an HttpStatusCodes_Ardunio.(h/cpp) #15

@EmperorArthur

Description

@EmperorArthur

Hello,

This code is extremely useful and thank you for creating it.

If possible, would you be able to produce an Arduino version of the library, and place it on PlatformIO?

Arduino faces some challenges which are not prevalent on other platforms. Primarily RAM and Flash constraints. In the microcontroller world, C strings are always stored in RAM, so special functions must be called to store it in program memory. Similarly, not inlining the function saves Flash memory.

My approach to converting the library was to have a header with:

#include <WString.h>
...
String reasonPhrase(int code);
...

And a cpp file with:

#include "HttpStatusCodes_Arduino.h"

String reasonPhrase(int code) {
...
case 100: return F("Continue");
...
}

I just did a replace of "std::String(" with "F(".

Why No Pull Request

I would have to get my bosses approval to submit a pull request, but can say exactly what I did, as it isn't a company secret or anything. Isn't IP law fun...

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions