Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Add body in PATCH request
Started by meganreiffer Sep 30 2018 05:05 AM

No replies to this topic
network patch
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

meganreiffer

[GLOBAL: userInfoPane.html]
meganreiffer
  • Observer

  • 2 posts
  • Corona SDK

I'm trying to send a simple HTTPS PATCH request and the body of the network request won't send. 

 

I've tried to deconstruct the problem away from the server I was using by making a simple local server that accepts an https PATCH request that I've tested with Postman and Node, but when I try running the code below in Corona I can get the url parameter, and header parameters, but the body always appears as empty. 

local function networkListener( event )
    
    print("event")
    if ( event.isError ) then
        print( "Network error: ", event.response )
    else
        print ( "RESPONSE: " .. event.response )
    end
end
local params = {
     headers=
    {
        ['Cache-Control']='no-cache',
        headerparam= 'headerValue',
        ['Content-Type']= 'application/json',
        ['proxy-connection']= 'keep-alive',
        ['accept-language']= 'en-US,en;q=0.9',
        ['accept-encoding']= 'gzip, deflate',
        accept= 'text/plain', rejectUnauthorized= false,
        requestCert= true,
        agent= false

    },
    body= '{"bodyParam":"here"}',
}
network.request( "https://localhost:8080/patchtest?urlparam=yes", "PATCH", networkListener, params )



[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: network, patch