Skip to content

Commit f7f83d8

Browse files
author
Justin Hayes
committed
Added failing test
1 parent 266ca83 commit f7f83d8

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/Requests/PayloadTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,32 @@ public function it_translates_a_guzzle_request_to_a_json_encoded_string()
3737
$this->assertEquals($expected, (string) new Payload($request));
3838
}
3939

40+
/**
41+
* @test
42+
*/
43+
public function it_translates_a_guzzle_request_with_content_to_a_json_encoded_string()
44+
{
45+
$now = (string) Carbon::now();
46+
47+
$method = 'GET';
48+
$uri = 'https://localhost';
49+
$id = Uuid::uuid4();
50+
51+
$request = (new GuzzleRequest('GET', 'https://localhost', [], 'content'))
52+
->withHeader('X-SIGNED-ID', $id)
53+
->withHeader('X-SIGNED-TIMESTAMP', $now);
54+
55+
$expected = json_encode([
56+
'id' => $id,
57+
'method' => $method,
58+
'timestamp' => $now,
59+
'uri' => $uri,
60+
'content' => 'content'
61+
], JSON_UNESCAPED_SLASHES);
62+
63+
$this->assertEquals($expected, (string) new Payload($request));
64+
}
65+
4066
/**
4167
* @test
4268
*/

0 commit comments

Comments
 (0)