FormData
The FormData is used create form data that is sent via APIRequestContext.
Methods
Set
Added in: v1.18Sets a field on the form. File values can be passed either as Path
or as FilePayload
.
var multipart = Context.APIRequest.CreateFormData();
// Only name and value are set.
multipart.Set("firstName", "John");
// Name, value, filename and Content-Type are set.
multipart.Set("profilePicture", new FilePayload()
{
Name = "john.jpg",
MimeType = "image/jpeg",
Buffer = File.ReadAllBytes("john.jpg")
});
await Page.APIRequest.PostAsync("https://localhost/submit", new() { Multipart = multipart });
Usage
FormData.Set(name, value);
Arguments
-
Field name.
-
Field value.
Returns