Skip to content

Commit bcb887f

Browse files
committed
fix: use correct http method format in functions_client
close #1149
1 parent 9002740 commit bcb887f

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

packages/functions_client/lib/src/functions_client.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ class FunctionsClient {
113113
);
114114
final fields = body as Map<String, String>?;
115115

116-
request = http.MultipartRequest(method.name, uri)
116+
request = http.MultipartRequest(method.value, uri)
117117
..fields.addAll(fields ?? {})
118118
..files.addAll(files);
119119
} else {
120-
final bodyRequest = http.Request(method.name, uri);
120+
final bodyRequest = http.Request(method.value, uri);
121121

122122
final String? bodyStr;
123123
if (body == null) {

packages/functions_client/lib/src/types.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ import 'dart:typed_data';
44
import 'package:http/http.dart';
55

66
enum HttpMethod {
7-
get,
8-
post,
9-
put,
10-
delete,
11-
patch,
7+
get("GET"),
8+
post("POST"),
9+
put("PUT"),
10+
delete("DELETE"),
11+
patch("PAtch");
12+
13+
/// The uppercase HTTP method name. This should be used for a [Request]
14+
final String value;
15+
const HttpMethod(this.value);
1216
}
1317

1418
class FunctionResponse {

0 commit comments

Comments
 (0)