Skip to content

parseBody() replaces Session parameters with form parameters in method POST #365

@matthieu-labas

Description

@matthieu-labas

When serving a POST from such a form (enctype being the default application/x-www-form-urlencoded):

<form method="post" action="dopost?file=afile_somewhere">
    <input type="text" name="file" value="/tmp/foo.txt" />
    <input type="submit" />
</form>
public Response serve(IHTTPSession session) {
    System.out.println("Before: "+session.getParms());
    if (session.getMethod() == Method.POST) {
        Map<String,String> fics = new HashMap<>();
        parseBody(fics);
        System.out.println("After: "+session.getParms());
    }
}

will show:

Before: {file=afile_somewhere}
After: {file=/tmp/foo.txt}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions