@@ -22,15 +22,21 @@ fn generate_delivery_fetch(
22
22
let json_body = json ! ( { "enteredDiscountCodes" : entered_discount_codes } ) ;
23
23
24
24
let request = DeliveryFetchHttpRequest {
25
- headers : vec ! [ DeliveryFetchHttpRequestHeader {
26
- name: "accept" . to_string( ) ,
27
- value: "application/json" . to_string( ) ,
28
- } ] ,
29
- method : DeliveryFetchHttpRequestMethod :: GET ,
25
+ headers : vec ! [
26
+ DeliveryFetchHttpRequestHeader {
27
+ name: "accept" . to_string( ) ,
28
+ value: "application/json" . to_string( ) ,
29
+ } ,
30
+ DeliveryFetchHttpRequestHeader {
31
+ name: "Content-Type" . to_string( ) ,
32
+ value: "application/json" . to_string( ) ,
33
+ }
34
+ ] ,
35
+ method : DeliveryFetchHttpRequestMethod :: POST ,
30
36
policy : DeliveryFetchHttpRequestPolicy {
31
37
read_timeout_ms : 2000 ,
32
38
} ,
33
- url : "<external server url>" . to_string ( ) ,
39
+ url : "<external- server- url>" . to_string ( ) ,
34
40
body : Some ( json_body. to_string ( ) ) ,
35
41
json_body : Some ( json_body. clone ( ) ) ,
36
42
} ;
@@ -59,15 +65,21 @@ mod tests {
59
65
let json_body = json ! ( { "enteredDiscountCodes" : [ "ABC" ] } ) ;
60
66
let expected = FunctionDeliveryFetchResult {
61
67
request : Some ( DeliveryFetchHttpRequest {
62
- headers : vec ! [ DeliveryFetchHttpRequestHeader {
63
- name: "accept" . to_string( ) ,
64
- value: "application/json" . to_string( ) ,
65
- } ] ,
66
- method : DeliveryFetchHttpRequestMethod :: GET ,
68
+ headers : vec ! [
69
+ DeliveryFetchHttpRequestHeader {
70
+ name: "accept" . to_string( ) ,
71
+ value: "application/json" . to_string( ) ,
72
+ } ,
73
+ DeliveryFetchHttpRequestHeader {
74
+ name: "Content-Type" . to_string( ) ,
75
+ value: "application/json" . to_string( ) ,
76
+ }
77
+ ] ,
78
+ method : DeliveryFetchHttpRequestMethod :: POST ,
67
79
policy : DeliveryFetchHttpRequestPolicy {
68
80
read_timeout_ms : 2000 ,
69
81
} ,
70
- url : "<external server url>" . to_string ( ) ,
82
+ url : "<external- server- url>" . to_string ( ) ,
71
83
json_body : Some ( json_body. clone ( ) ) ,
72
84
body : Some ( json_body. to_string ( ) ) ,
73
85
} ) ,
0 commit comments