Issue #175 resolved

utils.Mimer.translate_mime() doesn't handle the jQuery.post() right.

wxiluo avatarwxiluo created an issue

CONTENT_TYPE of jQuery.post() POST request is "application/x-www-form-urlencoded; charset=UTF-8". Piston only work with "application/x-www-form-urlencoded".

It's very bad.

Comments (5)

  1. Stephan Klein

    I stand corrected, it seems that this issue has been resolved in trunk.

    The lastest source in c4b2d21db51a uses

    if type_formencoded in ctype:
    

    which solves the issue.

    For anyone forced to use an older version of piston, I would recommend overriding the Resource class with something like this:

    import piston.utils
    from piston import Resrouce
    
    class MyResource(Resource):
      if piston.utils.__version__ <= "0.2.2":
        def __call__(self, request, *args, **kwargs):
          if request.META["CONTENT_TYPE"].startswith("application/x-www-form-urlencoded"):
            request.META["CONTENT_TYPE"] = "application/x-www-form-urlencoded"
          return super(MyResource, self).__call__(request, *args, **kwargs)
    
  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.