Nowhere on the internet is this specific problem or a fix for it mentioned, so here goes:
My app contains the following doGet()
and doPost()
functions:
function doGet (e){return ContentService.createTextOutput("User says: "+JSON.stringify(e))}
function doPost(e){return ContentService.createTextOutput("User says: "+JSON.stringify(e))}
GET http://*published URL*/+params
returns:
User says:
{
"queryString":"testparamA=abc&testparamB=bcd&testparamC=cde",
"parameter":
{
"testparamA":"abc",
"testparamB":"bcd",
"testparamC":"cde"
},
"contextPath":"",
"parameters":
{
"testparamA":["abc"],
"testparamB":["bcd"],
"testparamC":["cde"]
},
"contentLength":-1
}
Whereas, POST http://*published URL*/+params
returns:
User says:
{
"queryString":null,
"parameter":{},
"contextPath":"",
"parameters":{},
"contentLength":0
}
My goal is to access the POST
parameters. But something seems to be blocking the script from fetching them when transmitted using the POST
method. GET
seems to work just fine.
What am I missing and what is the solution?