Skip to content

Commit a135263

Browse files
authored
Merge pull request livecode#4558 from trevordevore/tkd-add-204-support
[Bug 15384] Add support for 204 header
2 parents 7f50fba + be090ce commit a135263

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

docs/notes/bugfix-15384.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix incorrect handling of a 204 response from a server.

ide-support/revliburl.livecodescript

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,7 @@ on ulDoProcess x,y
13061306

13071307
##normal case
13081308
case laLength[laUrl[x]] is not empty
1309+
case laStatusCode[laUrl[x]] is "204" -- When a 204 is returned no data is returned, just the length of the data in the header.
13091310

13101311
put laTmpData[laUrl[x]] into tData
13111312
ulStoreData laUrl[x],tData
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
script "TestLibUrlStatusCodes"
2+
3+
local sLogField
4+
5+
on TestSetup
6+
-- Only run these tests on desktop platforms
7+
if the platform is not among the items of "MacOS,Windows,Linux" then
8+
return "SKIP Tests are not runnable on" && the platform
9+
end if
10+
11+
local tLibURl
12+
put TestGetEngineRepositoryPath() & "/ide-support/revliburl.livecodescript" into tLibUrl
13+
send "revLoadLibrary" to stack tLibUrl
14+
end TestSetup
15+
16+
17+
on TestStatusCodes
18+
# Response Code 204
19+
set the socketTimeoutInterval to 10000
20+
put the milliseconds into tStartTime
21+
put URL "http://httpstat.us/204" into tData
22+
TestAssert "no error is reported", the result is empty
23+
TestAssert "response is not delayed until socket timeout", the milliseconds - tStartTime < 9000
24+
TestAssert "data is empty", tData is empty
25+
end TestStatusCodes

0 commit comments

Comments
 (0)