[Solved]. Can comebody test the Http methods with 2.20?

Just starting out? Need help? Post your questions and find answers here.
User avatar
SparrowhawkMMU
Posts: 281
Joined: Wed Aug 19, 2015 3:02 pm
Location: United Kingdom

[Solved]. Can comebody test the Http methods with 2.20?

Post by SparrowhawkMMU »

SpiderBasic 2.20 is reporting success = #False on API calls. However, my API logs say that SB correctly hit the API endpoints with the correct data and that they were processed correctly and the correct response sent back to the Sb generated webpage.

When I use my Http test tools to call the APIs directly, I get the correct header back (HTTP/1.1 200 OK) and the correct JSON is in the body

When I make an Http request using the #PB_Compiler_Filename as the URL, that works correctly.

Just wondering if I've missed something obvious, so can anyone else using APIs with SB confirm that theirs are still working OK?
Last edited by SparrowhawkMMU on Tue Oct 24, 2017 9:00 am, edited 1 time in total.
User avatar
SparrowhawkMMU
Posts: 281
Joined: Wed Aug 19, 2015 3:02 pm
Location: United Kingdom

Re: Can comebody test the Http methods with 2.20?

Post by SparrowhawkMMU »

Update: The SB PUT, PATCH and DELETE do not appear to be sent correctly - they are not appearing in PHP's $_SERVER['QUERY_STRING'] super global.

However, when I call the API using my API test tool using PUT, PATCH or DELETE, the APi is picking up the value correctly.

Here is an example of a request sent via the test tool:

Request:

Code: Select all

PUT http://rest-test.local?foo=bar
Accept-Encoding: gzip
User-Agent: Echo 1.2 rv:7334 (Macintosh; Mac OS X 10.11.6; en_GB)
Content-Length: 11

HELLO WORLD
Response:

Code: Select all

HTTP/1.1 200 OK
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Length: 122
X-Powered-By: PHP/7.1.10
Server: Apache/2.4.18 (Unix) PHP/7.1.10
Date: Mon, 23 Oct 2017 11:21:00 GMT

{
    "method": "PUT",
    "message": "2017-10-23T13:21:00+02:00 -> Method: PUT  Parameters: foo=bar  Body: HELLO WORLD"
}
So it looks like the Http handling is potentially broken in 2.20 - before I raise this as a bug, can anyone else confirm the behaviour?

To recap , looks like there MAY be 2 issues:

1) new HTTP verbs/methods not sent correctly

2) Http response success variable not being determined correctly

I can provide the full source (back and front end) if anyone wants to try running it
User avatar
SparrowhawkMMU
Posts: 281
Joined: Wed Aug 19, 2015 3:02 pm
Location: United Kingdom

Re: Can comebody test the Http methods with 2.20?

Post by SparrowhawkMMU »

Scratch all that, it's me being an utter pillock.

1) Didn't spot that my NoScript extension was enabled for the page. Doh!

2) my backend test script is not handling the preflight OPTIONS method call. Despite the fact that I went through this exact same exercise for a previous project, I seem to have the memory of a goldfish...
Post Reply