Issue #71 resolved

impossible to create a POST

Anonymous created an issue

It is impossible to create the POST using the blogserver example.

curl -u testuser:foobar "http://127.0.0.1:8000/api/posts/?format=yaml" -F "title=Testing again" -F "content=Foobar"

It seems that both the documentation and the code is outdated.

Comments (7)

  1. Anonymous

    Here it is a the result I get :

    yml@minnie:blogserver$ curl -u admin:admin "http://127.0.0.1:8000/api/posts.yaml" 
    - author: {username: testuser}
      content: This is just a sample post.
      content_length: 27
      created_on: 2009-04-27 04:55:23
      resource_uri: /api/posts.format
      title: Sample blogpost 1
    - author: {username: testuser}
      content: This is yet another sample post.
      content_length: 32
      created_on: 2009-04-27 04:55:33
      resource_uri: /api/posts.format
      title: Another sample post
    yml@minnie:blogserver$ curl -u admin:admin "http://127.0.0.1:8000/api/posts.yaml" -F "title=Testing again" -F "content=Foobar"
    Bad Requestyml@minnie:blogserver$
    
  2. Anonymous

    I continue to document the problem :

    This is where the issue seems to be :

    > /home/yml/workdir/django-piston/piston/utils.py(260)wrap()
        259         import ipdb; ipdb.set_trace()
    --> 260         if not m.content_type() in realmimes:
        261             return rc.BAD_REQUEST
    

    Where realmimes and m.content_type() are :

    ipdb> realmimes set(['application/x-yaml', 'application/json', 'text/xml', 'application/python-pickle']) ipdb> m.content_type <bound method Mimer.content_type of <piston.utils.Mimer object at 0xa5228ac>> ipdb> m.content_type() 'multipart/form-data; boundary=----------------------------844993d7526a'

  3. Anonymous

    Removing the decorator called 'require_extended' before the method create line 49 of handlers.py avoid this issue.

    I have also try to modify the curl command line without success so far :

    curl -v -u testuser:foobar -H 'Content-Type: application/yaml' -d {'title':'test','content':'super'} "http://127.0.0.1:8000/api/posts/?format=yaml"

  4. Anonymous

    I have just started to try piston and I am experiencing the same problem: while get works with curl command given in Read Me. post doesn't work. I see this has been marked resolved: "Changed status from new to resolved. Fixed in tip."

    how can I access "tip"?

  5. Log in to comment