I have a pylons controller action that accepts POST
@restrict('POST')
def myaction(self):
payload = json.loads(request.body)
I put properly formed JSON (I can do json.loads on it from python command line) in a file.
I am using the following command to send it to the controller:
$ curl -F payload=@./myfile -X POST -H 'Content-type:application/json' -v http://localhost:5000/mycontroller/myaction
on the controller side I’m expecting well formed JSON, but instead of getting JSON in request.body I’m getting a string with other stuff like
———————–6588b6680ebb\r\nContent-Disposition: form-data;
before the string containing a string representation of JSON I sent to myaction
What am I doing wrong?
The option
-Fis for multipart content, you should use –data / -d instead: