WebRequest.Entity

From Xojo Documentation

Read-Only Property (As String )
StringValue = aWebRequest.Entity

New in 2011r2

Supported for all project types and targets.

Some HTTP requests, particularly POST and PUT requests, contain additional data outside of the headers. This is that data.

Notes

Starting in 2014r2.1, the Entity parser for URLs which trigger the WebApplication.HandleSpecialURL or WebApplication.HandleURL event is disabled. This means that QueryString data will be accessed through the GetParameter method just like before, but you will need to parse the Entity data yourself. If you were relying on key/value pairs, you can still get them by simply splitting the data on "&", splitting each pair on "=", and then calling DecodeURLComponent on each of the values and push each key/value into a dictionary. Keep in mind that it is perfectly legal for an Entity to contain duplicate keys (something that our parser didn't handle), so you may need to come up with a way to store more than one value per key (a JSONItem would work for this as long as you remember that keys are case-sensitive).

Var varsTemp() As String = Split(Request.Entity, "&")
Var variables As New Dictionary
For i As Integer = 0 To ubound(varsTemp)
Var key As String = NthField(varsTemp(i), "=", 1)
Var value As String = NthField(varsTemp(i), "=", 2)
variables.Value(key) = value
Next

This gives you full control over what is done with the data, how conflict resolution is handled as well as creating a consistent experience whenever data is received via the QueryString and Entity portions of an HTTP request. It now works the same on CGI and standalone apps.

See Also

WebRequest.Entity, WebRequest.Method, WebRequest.QueryString, WebRequest.GetParameter