Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue retrieving http post values #1

Open
paolodina opened this issue Aug 25, 2014 · 0 comments
Open

Issue retrieving http post values #1

paolodina opened this issue Aug 25, 2014 · 0 comments

Comments

@paolodina
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant