Sets the request header with the key and value.
See list of valid http header fields here: https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
Use the example script below to test this function
against our test webservice (https://test.nwscloud.ch/test)
Parameters:
Name |
Type |
Description |
conID |
String |
Identifier of existing htmlConnection
object |
key |
String |
keyname to be set |
value |
String |
value for the key |
Returns:
Type |
Value |
Description |
String |
OK |
The request header has been set |
String |
ERROR |
Setting of the request header failed |
Available in:
WindowMain |
WindowLink |
YES |
NO |
Example XojoScript:
// Create new URLConnection
Dim conID As String = htmlConnection
// Set RequestHeader
Dim response as String = htmlRequestHeader(conID,"Content-Type","application/json; charset=utf-8")
If response = "ERROR" Then
MsgBox("ERROR : Setting request header failed.")
Call htmlConnectionClose(conID)
Return
End If
// Define path to test webservice
Dim url As String = "https://test.nwscloud.ch/test"
// Send Update Request for current address to
Webserver
Dim jsonresponse As String = htmlsendSync(conID,"PATCH", url,15)
MsgBox("Response : " + jsonresponse)
Call htmlConnectionClose(conID)