toPostRequestInformation method

RequestInformation toPostRequestInformation(
  1. MultipartBody body, [
  2. void requestConfiguration(
    1. RequestConfiguration<DefaultQueryParameters>
    )?
])

To upload a file to Stripe, you need to send a request of type multipart/form-data. Include the file you want to upload in the request, and the parameters for creating a file.

All of Stripe’s officially supported Client libraries support sending multipart/form-data.

[body] The request body [requestConfiguration] Configuration for the request such as headers, query parameters, and middleware options.

Implementation

RequestInformation toPostRequestInformation(MultipartBody body,
    [void Function(RequestConfiguration<DefaultQueryParameters>)?
        requestConfiguration]) {
  var requestInfo = RequestInformation(
      httpMethod: HttpMethod.post,
      urlTemplate: urlTemplate,
      pathParameters: pathParameters);
  requestInfo.configure<DefaultQueryParameters>(
      requestConfiguration, () => DefaultQueryParameters());
  requestInfo.headers.put('Accept', 'application/json');
  requestInfo.setContentFromParsable(
      requestAdapter, 'multipart/form-data', body);
  return requestInfo;
}