Skip to content

Issue retrieving http post values #1

@paolodina

Description

@paolodina

I have a problem with values submitted via POST form. This app skeleton can be used to see what's happening.

# view
@app.route('/foo', methods=('GET', 'POST'))
def foo():
    submitted = ''
    if flask.request.method == 'POST':
        import pdb; pdb.set_trace() # used later to print flask.request.form
        submitted = flask.request.form.get('username')
    return render_template('foo.html', submitted=submitted)
<!-- template -->
<p>Type a username:</p>
<form method="post" action="/foo">
  <input type="text" name="username">
  <input type="submit">
</form>
<p>You typed: {{ submitted }}</p>

Suppose the submitted value is "my name".

Case 1 - flask dev server:

(Pdb) flask.request.form # OK
ImmutableMultiDict([('username', u'my name')])

Case 2 - fireside generated war executed by jetty-runner:

(Pdb) print flask.request.form # Not the expected result
{'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00': [u'']}

There are two problems, it's a dictionary instead of ImmutableMultiDict and the value is a sequence of \x00. The code is the same in both case 1 and 2. Do you have any clue what's causing this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions