@@ -36,6 +36,8 @@ final class Test_Client: XCTestCase {
36
36
}
37
37
38
38
func testListPets_200( ) async throws {
39
+ let requestUUID = UUID ( )
40
+ let responseUUID = UUID ( )
39
41
transport = . init { ( request: HTTPRequest , body: HTTPBody ? , baseURL: URL , operationID: String ) in
40
42
XCTAssertEqual ( operationID, " listPets " )
41
43
XCTAssertEqual (
@@ -44,12 +46,12 @@ final class Test_Client: XCTestCase {
44
46
)
45
47
XCTAssertEqual ( baseURL. absoluteString, " /api " )
46
48
XCTAssertEqual ( request. method, . get)
47
- XCTAssertEqual ( request. headerFields, [ . accept: " application/json " , . init( " My-Request-UUID " ) !: " abcd-1234 " ] )
49
+ XCTAssertEqual ( request. headerFields, [ . accept: " application/json " , . init( " My-Request-UUID " ) !: requestUUID . uuidString ] )
48
50
XCTAssertNil ( body)
49
51
return try HTTPResponse (
50
52
status: . ok,
51
53
headerFields: [
52
- . contentType: " application/json " , . init( " my-response-uuid " ) !: " abcd " ,
54
+ . contentType: " application/json " , . init( " my-response-uuid " ) !: responseUUID . uuidString ,
53
55
. init( " my-tracing-header " ) !: " 1234 " ,
54
56
]
55
57
)
@@ -67,14 +69,14 @@ final class Test_Client: XCTestCase {
67
69
let response = try await client. listPets (
68
70
. init(
69
71
query: . init( limit: 24 , habitat: . water, feeds: [ . herbivore, . carnivore] , since: . test) ,
70
- headers: . init( My_hyphen_Request_hyphen_UUID: " abcd-1234 " )
72
+ headers: . init( My_hyphen_Request_hyphen_UUID: requestUUID )
71
73
)
72
74
)
73
75
guard case let . ok( value) = response else {
74
76
XCTFail ( " Unexpected response: \( response) " )
75
77
return
76
78
}
77
- XCTAssertEqual ( value. headers. My_hyphen_Response_hyphen_UUID, " abcd " )
79
+ XCTAssertEqual ( value. headers. My_hyphen_Response_hyphen_UUID, responseUUID )
78
80
XCTAssertEqual ( value. headers. My_hyphen_Tracing_hyphen_Header, " 1234 " )
79
81
switch value. body {
80
82
case . json( let pets) : XCTAssertEqual ( pets, [ . init( id: 1 , name: " Fluffz " ) ] )
0 commit comments