Skip to content

HttpRequestParser multipart/form-data #14

Description

@RychkovIurii

[ERROR] HttpRequestParser : Unsupported Content-Type for POST: multipart/form-data; boundary=----geckoformboundary34d3cd60c71300afd1a236dfbfe2355b

How can we reproduce error:
Navigate to http://127.0.0.1:8001/uploads/form_multipart.html.
Upload file.

It comes from HttpRequestParser.
Check here:
// Allow only specific Content-Types for POST requests
static const std::setstd::string validTypes = {
"application/x-www-form-urlencoded",
"multipart/form-data",
"text/plain",
"application/json",
"test/file" // only for testing purposes
};

    std::string ctLower = toLower(contentType);
    if (validTypes.find(ctLower) == validTypes.end()) {
        errorCode = 415; // Unsupported Media Type
        Logger::logFrom(LogLevel::ERROR, "HttpRequestParser", "Unsupported Content-Type for POST: " + contentType);
        return false;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions