Skip to content

Commit 61cc7c0

Browse files
j8000j8000
andauthored
fix(functions_client): use uppercase HTTP method in requests (#1353)
Co-authored-by: j8000 <jakob@utopiasoft.io>
1 parent 01551e3 commit 61cc7c0

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

packages/functions_client/lib/src/functions_client.dart

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

135-
request = http.MultipartRequest(method.name, uri)
135+
request = http.MultipartRequest(method.name.toUpperCase(), uri)
136136
..fields.addAll(fields ?? {})
137137
..files.addAll(files);
138138
} else {
139-
final bodyRequest = http.Request(method.name, uri);
139+
final bodyRequest = http.Request(method.name.toUpperCase(), uri);
140140

141141
if (body == null) {
142142
// No body to set

packages/functions_client/test/functions_dart_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void main() {
186186
);
187187

188188
final req = customHttpClient.receivedRequests.last;
189-
expect(req.method, 'get');
189+
expect(req.method, 'GET');
190190
});
191191

192192
test('PUT method', () async {
@@ -196,7 +196,7 @@ void main() {
196196
);
197197

198198
final req = customHttpClient.receivedRequests.last;
199-
expect(req.method, 'put');
199+
expect(req.method, 'PUT');
200200
});
201201

202202
test('DELETE method', () async {
@@ -206,7 +206,7 @@ void main() {
206206
);
207207

208208
final req = customHttpClient.receivedRequests.last;
209-
expect(req.method, 'delete');
209+
expect(req.method, 'DELETE');
210210
});
211211

212212
test('PATCH method', () async {
@@ -216,7 +216,7 @@ void main() {
216216
);
217217

218218
final req = customHttpClient.receivedRequests.last;
219-
expect(req.method, 'patch');
219+
expect(req.method, 'PATCH');
220220
});
221221
});
222222

0 commit comments

Comments
 (0)