Hello there,
Is there a known method to use a TMiletusStringListto create data in the format expected for PostData on TWebHttpRequest? I'm having a hard time getting it to work properly with PocketBase's authentication endpoint (which otherwise seems like an excellent pairing with Melitus in addition to XData; I plan to use it for user management mainly): Basics - Authentication - Docs - PocketBase
It's all a bit vague, but basically I am trying to recreate this request, which works correctly (as generated by Postman, where it also works as expected):
curl --location 'http://127.0.0.1:8090/api/collections/users/auth-with-password' \
--form 'identity="isaac"' \
--form 'password="foobar"'
My impression was that this would generate data in the format like:
identity=isaac&password=foobar
(Anyway that's how I've usually done it if it isn't JSON encoded data in the past for POST requests.)
But when I put that into PostData on the TWebHttpRequest object it is rejected...
Any ideas? Like I opened with, I'd like to use TMiletusStringList to generate my POST request bodies for TWebHttpRequest , so I am hoping there's an easy way to do that.
The request above as PowerShell in case you don't have a POSIX curl:
$multipartContent = [System.Net.Http.MultipartFormDataContent]::new()
$stringHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
$stringHeader.Name = "identity"
$stringContent = [System.Net.Http.StringContent]::new("isaac")
$stringContent.Headers.ContentDisposition = $stringHeader
$multipartContent.Add($stringContent)
$stringHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
$stringHeader.Name = "password"
$stringContent = [System.Net.Http.StringContent]::new("foobar")
$stringContent.Headers.ContentDisposition = $stringHeader
$multipartContent.Add($stringContent)
$body = $multipartContent
$response = Invoke-RestMethod 'http://127.0.0.1:8090/api/collections/users/auth-with-password' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
Thanks for all your help so far!