11import { getCanonicalQuery } from "./getCanonicalQuery" ;
22import { HttpRequest } from "@aws-sdk/protocol-http" ;
33
4- const request = new HttpRequest ( {
4+ const httpRequestOptions = {
55 method : "POST" ,
66 protocol : "https:" ,
77 path : "/" ,
88 headers : { } ,
99 hostname : "foo.us-east-1.amazonaws.com"
10- } ) ;
10+ } ;
1111
1212describe ( "getCanonicalQuery" , ( ) => {
1313 it ( "should return an empty string for requests with no querystring" , ( ) => {
14- expect ( getCanonicalQuery ( request ) ) . toBe ( "" ) ;
14+ expect ( getCanonicalQuery ( new HttpRequest ( httpRequestOptions ) ) ) . toBe ( "" ) ;
1515 } ) ;
1616
1717 it ( "should serialize simple key => value pairs" , ( ) => {
1818 expect (
1919 getCanonicalQuery (
2020 new HttpRequest ( {
21- ...request ,
21+ ...httpRequestOptions ,
2222 query : { fizz : "buzz" , foo : "bar" }
2323 } )
2424 )
@@ -29,7 +29,7 @@ describe("getCanonicalQuery", () => {
2929 expect (
3030 getCanonicalQuery (
3131 new HttpRequest ( {
32- ...request ,
32+ ...httpRequestOptions ,
3333 query : { foo : "bar" , baz : "quux" , fizz : "buzz" }
3434 } )
3535 )
@@ -40,7 +40,7 @@ describe("getCanonicalQuery", () => {
4040 expect (
4141 getCanonicalQuery (
4242 new HttpRequest ( {
43- ...request ,
43+ ...httpRequestOptions ,
4444 query : { "🐎" : "🦄" , "💩" : "☃️" }
4545 } )
4646 )
@@ -51,7 +51,7 @@ describe("getCanonicalQuery", () => {
5151 expect (
5252 getCanonicalQuery (
5353 new HttpRequest ( {
54- ...request ,
54+ ...httpRequestOptions ,
5555 query : {
5656 "x-amz-signature" : "foo" ,
5757 "X-Amz-Signature" : "bar" ,
@@ -66,7 +66,7 @@ describe("getCanonicalQuery", () => {
6666 expect (
6767 getCanonicalQuery (
6868 new HttpRequest ( {
69- ...request ,
69+ ...httpRequestOptions ,
7070 query : { foo : [ "bar" , "baz" ] }
7171 } )
7272 )
@@ -77,7 +77,7 @@ describe("getCanonicalQuery", () => {
7777 expect (
7878 getCanonicalQuery (
7979 new HttpRequest ( {
80- ...request ,
80+ ...httpRequestOptions ,
8181 query : { snap : [ "pop" , "crackle" ] }
8282 } )
8383 )
@@ -88,7 +88,7 @@ describe("getCanonicalQuery", () => {
8888 expect (
8989 getCanonicalQuery (
9090 new HttpRequest ( {
91- ...request ,
91+ ...httpRequestOptions ,
9292 query : { "🐎" : [ "💩" , "🦄" ] }
9393 } )
9494 )
@@ -99,7 +99,7 @@ describe("getCanonicalQuery", () => {
9999 expect (
100100 getCanonicalQuery (
101101 new HttpRequest ( {
102- ...request ,
102+ ...httpRequestOptions ,
103103 query : { foo : "bar" , baz : new Uint8Array ( 0 ) as any }
104104 } )
105105 )
0 commit comments