|
12 | 12 | // |
13 | 13 | //===----------------------------------------------------------------------===// |
14 | 14 |
|
15 | | -@testable import AWSLambdaEvents |
16 | 15 | import XCTest |
17 | 16 |
|
| 17 | +@testable import AWSLambdaEvents |
| 18 | + |
18 | 19 | class APIGatewayWebSocketsTests: XCTestCase { |
19 | 20 | static let exampleConnectEventBody = """ |
20 | | - { |
21 | | - "headers": { |
22 | | - "Host": "lqrlmblaa2.execute-api.us-east-1.amazonaws.com", |
23 | | - "Origin": "wss://lqrlmblaa2.execute-api.us-east-1.amazonaws.com", |
24 | | - "Sec-WebSocket-Extensions": "", |
25 | | - "Sec-WebSocket-Key": "am5ubWVpbHd3bmNyYXF0ag==", |
26 | | - "Sec-WebSocket-Version": "13", |
27 | | - "X-Amzn-Trace-Id": "Root=1-64b83950-42de8e247b4c2b43091ef67c", |
28 | | - "X-Forwarded-For": "24.148.42.16", |
29 | | - "X-Forwarded-Port": "443", |
30 | | - "X-Forwarded-Proto": "https" |
31 | | - }, |
32 | | - "multiValueHeaders": { |
33 | | - "Host": [ "lqrlmblaa2.execute-api.us-east-1.amazonaws.com" ], |
34 | | - "Origin": [ "wss://lqrlmblaa2.execute-api.us-east-1.amazonaws.com" ], |
35 | | - "Sec-WebSocket-Extensions": [ |
36 | | - "permessage-deflate; client_max_window_bits; server_max_window_bits=15" |
37 | | - ], |
38 | | - "Sec-WebSocket-Key": [ "am5ubWVpbHd3bmNyYXF0ag==" ], |
39 | | - "Sec-WebSocket-Version": [ "13" ], |
40 | | - "X-Amzn-Trace-Id": [ "Root=1-64b83950-42de8e247b4c2b43091ef67c" ], |
41 | | - "X-Forwarded-For": [ "24.148.42.16" ], |
42 | | - "X-Forwarded-Port": [ "443" ], |
43 | | - "X-Forwarded-Proto": [ "https" ] |
44 | | - }, |
45 | | - "requestContext": { |
46 | | - "routeKey": "$connect", |
47 | | - "eventType": "CONNECT", |
48 | | - "extendedRequestId": "IU3kkGyEoAMFwZQ=", |
49 | | - "requestTime": "19/Jul/2023:19:28:16 +0000", |
50 | | - "messageDirection": "IN", |
51 | | - "stage": "dev", |
52 | | - "connectedAt": 1689794896145, |
53 | | - "requestTimeEpoch": 1689794896162, |
54 | | - "identity": { "sourceIp": "24.148.42.16" }, |
55 | | - "requestId": "IU3kkGyEoAMFwZQ=", |
56 | | - "domainName": "lqrlmblaa2.execute-api.us-east-1.amazonaws.com", |
57 | | - "connectionId": "IU3kkeN4IAMCJwA=", |
58 | | - "apiId": "lqrlmblaa2" |
59 | | - }, |
60 | | - "isBase64Encoded": false |
61 | | - } |
62 | | - """ |
| 21 | + { |
| 22 | + "headers": { |
| 23 | + "Host": "lqrlmblaa2.execute-api.us-east-1.amazonaws.com", |
| 24 | + "Origin": "wss://lqrlmblaa2.execute-api.us-east-1.amazonaws.com", |
| 25 | + "Sec-WebSocket-Extensions": "", |
| 26 | + "Sec-WebSocket-Key": "am5ubWVpbHd3bmNyYXF0ag==", |
| 27 | + "Sec-WebSocket-Version": "13", |
| 28 | + "X-Amzn-Trace-Id": "Root=1-64b83950-42de8e247b4c2b43091ef67c", |
| 29 | + "X-Forwarded-For": "24.148.42.16", |
| 30 | + "X-Forwarded-Port": "443", |
| 31 | + "X-Forwarded-Proto": "https" |
| 32 | + }, |
| 33 | + "multiValueHeaders": { |
| 34 | + "Host": [ "lqrlmblaa2.execute-api.us-east-1.amazonaws.com" ], |
| 35 | + "Origin": [ "wss://lqrlmblaa2.execute-api.us-east-1.amazonaws.com" ], |
| 36 | + "Sec-WebSocket-Extensions": [ |
| 37 | + "permessage-deflate; client_max_window_bits; server_max_window_bits=15" |
| 38 | + ], |
| 39 | + "Sec-WebSocket-Key": [ "am5ubWVpbHd3bmNyYXF0ag==" ], |
| 40 | + "Sec-WebSocket-Version": [ "13" ], |
| 41 | + "X-Amzn-Trace-Id": [ "Root=1-64b83950-42de8e247b4c2b43091ef67c" ], |
| 42 | + "X-Forwarded-For": [ "24.148.42.16" ], |
| 43 | + "X-Forwarded-Port": [ "443" ], |
| 44 | + "X-Forwarded-Proto": [ "https" ] |
| 45 | + }, |
| 46 | + "requestContext": { |
| 47 | + "routeKey": "$connect", |
| 48 | + "eventType": "CONNECT", |
| 49 | + "extendedRequestId": "IU3kkGyEoAMFwZQ=", |
| 50 | + "requestTime": "19/Jul/2023:19:28:16 +0000", |
| 51 | + "messageDirection": "IN", |
| 52 | + "stage": "dev", |
| 53 | + "connectedAt": 1689794896145, |
| 54 | + "requestTimeEpoch": 1689794896162, |
| 55 | + "identity": { "sourceIp": "24.148.42.16" }, |
| 56 | + "requestId": "IU3kkGyEoAMFwZQ=", |
| 57 | + "domainName": "lqrlmblaa2.execute-api.us-east-1.amazonaws.com", |
| 58 | + "connectionId": "IU3kkeN4IAMCJwA=", |
| 59 | + "apiId": "lqrlmblaa2" |
| 60 | + }, |
| 61 | + "isBase64Encoded": false |
| 62 | + } |
| 63 | + """ |
63 | 64 |
|
64 | 65 | // MARK: - Request - |
65 | 66 |
|
|
0 commit comments