put method

Future<Response> put(
  1. Uri url, {
  2. required RequestBody? body,
  3. List<Header> headers = const [],
  4. Map<String, String> params = const {},
})

Implementation

Future<Response> put(
  Uri url, {
  required RequestBody? body,
  List<Header> headers = const [],
  Map<String, String> params = const {},
}) async {
  final urlWithParams = url.includeParams(params);
  final rawResponse = await _client.put(
    urlWithParams,
    headers: {
      for (final header in headers) header.name: header.value,
      if (body != null)
        for (final header in body.headers) header.name: header.value,
    },
    body: body?.body,
  );

  return Response(rawResponse);
}