1

Im using the awesome python bottle app as a JSON server.

POST is working fine but not PUT

I use the following in POST to retrieve the POST'ed data.

data = request.body.getvalue()
if data: 
    ...

Whats the equiv for capturing PUT data?

Secondly, do I use the same --data option on curl for testing (aside from changing the -X verb from POST to PUT

curl -X PUT --data '{"key":"value"}' http://myserver.com/1/object/type
Gabe Rainbow
  • 3,658
  • 4
  • 32
  • 42

1 Answers1

3

Whats the equiv for capturing PUT data?

See if this does the trick:

data = request.body.read()

do I use the same --data option on curl for testing

Yep, that should work.

ron rothman
  • 17,348
  • 7
  • 41
  • 43