I dumbed down the script so I could just force a single REQUESTHTTPX command each time I stop and start the script. It seems no matter what I place in the header, so long as it is not null and it starts with Content-Type=, the command executes and I receive the anticipated response from the database server. I can even leave the header as Content-Type= with nothing after the equal sign and it seems to execute but no data is written.
POST_DATA:
FileSize% = FS "size", "/usr/sdext/datatopost"
url$ = "http://IP_ADDRESS:PORT/write?db=import"
method$ = "POST"
//header$ = "Content-Type=text/plain;charset=utf-8"
header$ = "Content-Type=X"
REQUESTHTTPX url$, method$, header$, "", "&[$dtUF$ftB$uf/usr/sdext/datatopost$fndatatopost.bin]"
actionID% = GETSYS PRG,"ACTIONID"
PRINT "Request actionID: "; actionID%
ONSTATUS "GOTO ON_EVENT"
END
ON_EVENT:
eventID% = GETSYS PRG,"EVTINFO"
IF (eventID% = actionID%) THEN
SETSYS PRG,"ACTIONID",eventID%
stat% = GETSYS PRG,"ACTIONSTAT"
IF (stat% = 0) THEN
GOTO RESPONSE
ELSE
PRINT "Error: " + STR$ stat%
ENDIF
ENDIF
END
RESPONSE:
a$ = RESPONSEHTTPX "STATUSCODE"
$LogText$ = "***POST FILE ** STATUSCODE: " + a$ + " ACTIONSTAT: " + STR$ stat%
b$ = RESPONSEHTTPX "HEADER"
PRINT "***all headers: " + b$;
$FileSize% = FS "size", "/usr/sdext/datatopost"
$LogText$ = $LogText$ + " FILESIZE: " + STR$ $FileSize%
PRINT $LogText$
LOGEVENT $LogText$
END
Each time I execute the above, I receive this response from the database server:
When I send the same file via the Postman app I receive this response:
The one thing I notice as different between the responses is the response to the eWON includes connection: close whereas that is not include in the response to Postman.