Hey, I was running into the same problem. I hope this can solve your
problem...
I'm developing a RESTful API to add new resources (records in DB)
I'm exposing the API using this code in my default.py controller:
@request.restful()
def api():
rest = module_api.RESTful(db, auth.user_id)
def POST(*args, **vars):
try:
return rest.process_post(*args, **vars)
except module_api.Error as e:
raise HTTP(e.code)
return dict(POST=POST)
As you can see my POST request are processed by a function called process_post
inside a module called module_api
I'm passing *args and **vars to process_post.
When I have your problem I was using an aux function inside my process_post
function like this:
def process_post(*args, **vars):
# Aux function to map from args passed in the URL to real db resource
def map_resource(*args, **vars):
# some code
# some code calling map_resource(*args, **vars)...
Every POST I made resulted in:
raise HTTP(400, "Bad Request - HTTP body is incomplete") in line 252 form
gluon/globals.py
Then I changed my code to something like:
def process_post(*args, **vars):
# Aux function to map from args passed in the URL to real db resource
def map_resource():
# some code using *args and **vars from process_post
# some code calling map_resource()...
I don't know if your are running into the same problem, but *this solved my
problem*.
Greets!
Sebastián Tromer.
El martes, 1 de octubre de 2013 10:47:30 UTC-3, Ramos escribió:
>
> hello i have a user trying to create a record.
> When he submits he gets a blank page saying
>
> Bad Request Http body is incomplete
>
>
> What is this?
>
> I dont have any ticket in my admin.
>
>
> Thank you
> António
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.