Page 1 of 1

put header "Status:400" fails

Posted: Wed Nov 20, 2019 12:39 am
by KimD
I'm teaching myself to build a REST API using LC Server. I've got my prototype API running on hostm (which was very easy to get going). I'm testing using Postman. I've encountered a weird little problem.

The below works fine -
<?lc
put header "Status:428"
put "It all went South"
?>

Postman receives the status code 428 and "It all went south".

But if I substitute -
<?lc
put header "Status:400"
put "It all went South"
?>

Postman receives the status code 403 (Forbidden) and does NOT receive "It all went south".

I've tested about 5 other header status codes. They all worked.

I can easily work around this by putting a status code other than 400 (although none of the others accurately reflects the nature of the problem). I don't know if this is a LC issue or a hostm issue, but I thought that I'd try the forum first. Has anyone seen this before, or can you reproduce it, or is it definitely a hostm issue, or something else?

Thanks

Kim

Re: put header "Status:400" fails

Posted: Thu Nov 21, 2019 1:47 pm
by sphere
I tested for you.

I get in both cases "It went south", so it works here.
No errors.

Re: put header "Status:400" fails

Posted: Thu Nov 21, 2019 8:22 pm
by KimD
Thanks for checking that. I'll try asking hostm.

Regards

Kim

Re: put header "Status:400" fails - CLOSED

Posted: Fri Nov 22, 2019 2:44 am
by KimD
Hostm got back to me (very quickly) with the following -

"We can confirm that the issue with status code 400 is not LiveCode-specific, as we’ve tested it with other server-side languages with the same result on our servers. It appears to be have something to do with LiteSpeed, the web server that we utilize, since the issue does not occur with the standard web server (Apache) that comes with cPanel."

Re: put header "Status:400" fails

Posted: Fri Nov 22, 2019 9:17 am
by SparkOut
<silly aside>What if you try Status:418?</silly aside>