@@ -103,6 +103,72 @@ public function it_translates_an_illuminate_request_to_a_json_encoded_string()
103
103
$ this ->assertEquals ($ expected , (string ) new Payload ($ request ));
104
104
}
105
105
106
+ /**
107
+ * @test
108
+ */
109
+ public function it_upper_cases_the_illuminate_request_method ()
110
+ {
111
+ $ now = (string )Carbon::now ();
112
+ $ id = (string )Uuid::uuid4 ();
113
+
114
+ $ uri = 'https://localhost ' ;
115
+ $ method = 'get ' ;
116
+ $ parameters = [];
117
+ $ cookies = [];
118
+ $ files = [];
119
+ $ server = [
120
+ 'HTTP_X-SIGNED-ID ' => $ id ,
121
+ 'HTTP_X-SIGNED-TIMESTAMP ' => $ now
122
+ ];
123
+ $ content = null ;
124
+
125
+ $ request = IlluminateRequest::create (
126
+ $ uri ,
127
+ $ method ,
128
+ $ parameters ,
129
+ $ cookies ,
130
+ $ files ,
131
+ $ server ,
132
+ $ content
133
+ );
134
+
135
+ $ expected = json_encode ([
136
+ 'id ' => $ id ,
137
+ 'method ' => 'GET ' ,
138
+ 'timestamp ' => $ now ,
139
+ 'uri ' => $ uri ,
140
+ 'content ' => $ request ->getContent ()
141
+ ], JSON_UNESCAPED_SLASHES );
142
+
143
+ $ this ->assertEquals ($ expected , (string )new Payload ($ request ));
144
+ }
145
+
146
+
147
+ /**
148
+ * @test
149
+ */
150
+ public function it_upper_cases_the_guzzle_request_method ()
151
+ {
152
+ $ now = (string )Carbon::now ();
153
+
154
+ $ uri = 'https://localhost ' ;
155
+ $ id = Uuid::uuid4 ();
156
+
157
+ $ request = (new GuzzleRequest ('get ' , 'https://localhost ' , [], 'content ' ))
158
+ ->withHeader ('X-SIGNED-ID ' , $ id )
159
+ ->withHeader ('X-SIGNED-TIMESTAMP ' , $ now );
160
+
161
+ $ expected = json_encode ([
162
+ 'id ' => $ id ,
163
+ 'method ' => 'GET ' ,
164
+ 'timestamp ' => $ now ,
165
+ 'uri ' => $ uri ,
166
+ 'content ' => 'content '
167
+ ], JSON_UNESCAPED_SLASHES );
168
+
169
+ $ this ->assertEquals ($ expected , (string )new Payload ($ request ));
170
+ }
171
+
106
172
/**
107
173
* @test
108
174
*/
0 commit comments