Jasonette / JASONETTE-Android

📡 Native App over HTTP, on Android
https://www.jasonette.com
Other
1.6k stars 270 forks source link

$network.request with method POST (appears to) disregard the "content_type": "json" #118

Open darenr opened 7 years ago

darenr commented 7 years ago

the action below on iOS sends (correctly) JSON encoded data of the form

print request.data 
{"object_type":"news","action_type":"like","object_id":"42"}

However, on Android the data is form encoded

print request.data
object_id=42&object_type=news&action_type=like
        "action": {
            "type": "$network.request",
            "options": {
                "url": "https://kadist-ios.herokuapp.com/action",
                "method": "post",
                "content_type": "json",
                "data": {
                    "action_type": "like",
                    "object_type": "news",
                    "object_id": "{{$get.permalink}}"
                }
            }
        }
realitix commented 7 years ago

Hello @darenr, Indeed there is a bug. Check out here https://github.com/Jasonette/JASONETTE-Android/blob/develop/app/src/main/java/com/jasonette/seed/Action/JasonNetworkAction.java#L120

content_type is used only in header. The _request function needs a big refactoring... I will do it as soon as I have time.