I'm using grape, grape-swagger and swagger-ui, everything works perfect.
Except when I try to post some data to the api.
The body field contains some Chinese wording. When I debug in backend(Rails+Grape), the content of body is non utf-8 characters. The rails config and browsers view setting are both utf-8.
I try to use curl to test the API directly, it would not have problem.
I'm using grape, grape-swagger and swagger-ui, everything works perfect.
Except when I try to post some data to the api. The body field contains some Chinese wording. When I debug in backend(Rails+Grape), the content of body is non utf-8 characters. The rails config and browsers view setting are both utf-8.
I try to use curl to test the API directly, it would not have problem.
curl -d "team_id=22&user_id=44&user_avatar=https://towerfiles.oss.aliyuncs.com/avatar/4e1e13c4157944358b513f6d10a571bf&body=你好&user_name=mafai" http://localhost:3000/api/v1/posts.json
Here's the log capture by firebug when using swagger-ui.
Accept application/json, text/javascript, /; q=0.01 Accept-Encoding gzip, deflate Accept-Language en-US,en;q=0.5 Cache-Control no-cache Connection keep-alive Content-Length 715 Content-Type multipart/form-data; boundary=---------------------------96109097118314405101137539119 Cookie email=xxx%40gmail.com; remember_user_token=BAhbB1sGaQhJIiIkMmEkMTAkLnY1WUI1MzN5SEFpQTJoQXVRNGMxZQY6BkVU--2ee40ebda7767c8a8e723ccd83a5554a7a98cda6; _aquayee_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJTI0ZmJjM2FmY2VlMmM3NTU1ODJkOWEyNzZlZjhlZWRmBjsAVEkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkISSIiJDJhJDEwJC52NVlCNTMzeUhBaUEyaEF1UTRjMWUGOwBU--965bcc64b3ca53f86f053ab53f7365d2fe21e1af Host localhost:3000 Pragma no-cache Referer http://localhost:3000/swagger/index.html User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:22.0) Gecko/20100101 Firefox/22.0 X-Requested-With XMLHttpRequest