1
- import { test as it , describe , expect } from "vitest" ;
2
-
3
1
import { AccessAnalyzer } from "@aws-sdk/client-accessanalyzer" ;
4
2
import { S3 } from "@aws-sdk/client-s3" ;
5
3
import { XRay } from "@aws-sdk/client-xray" ;
4
+ import { describe , expect , test as it } from "vitest" ;
6
5
7
6
import { requireRequestsFrom } from "../../../private/aws-util-test/src" ;
8
7
9
8
describe ( "middleware-content-length" , ( ) => {
10
9
describe ( AccessAnalyzer . name , ( ) => {
11
10
it ( "should not add content-length if no body" , async ( ) => {
12
- const client = new AccessAnalyzer ( { region : "us-west-2" } ) ;
11
+ const client = new AccessAnalyzer ( {
12
+ region : "us-west-2" ,
13
+ credentials : {
14
+ accessKeyId : "INTEG" ,
15
+ secretAccessKey : "INTEG" ,
16
+ } ,
17
+ } ) ;
13
18
requireRequestsFrom ( client ) . toMatch ( {
14
19
headers : {
15
20
"content-length" : / u n d e f i n e d / ,
@@ -24,7 +29,13 @@ describe("middleware-content-length", () => {
24
29
} ) ;
25
30
26
31
it ( "should add content-length if body present" , async ( ) => {
27
- const client = new AccessAnalyzer ( { region : "us-west-2" } ) ;
32
+ const client = new AccessAnalyzer ( {
33
+ region : "us-west-2" ,
34
+ credentials : {
35
+ accessKeyId : "INTEG" ,
36
+ secretAccessKey : "INTEG" ,
37
+ } ,
38
+ } ) ;
28
39
requireRequestsFrom ( client ) . toMatch ( {
29
40
headers : {
30
41
"content-length" : / 1 0 6 / ,
@@ -42,7 +53,13 @@ describe("middleware-content-length", () => {
42
53
43
54
describe ( S3 . name , ( ) => {
44
55
it ( "should not add content-length if no body" , async ( ) => {
45
- const client = new S3 ( { region : "us-west-2" } ) ;
56
+ const client = new S3 ( {
57
+ region : "us-west-2" ,
58
+ credentials : {
59
+ accessKeyId : "INTEG" ,
60
+ secretAccessKey : "INTEG" ,
61
+ } ,
62
+ } ) ;
46
63
requireRequestsFrom ( client ) . toMatch ( {
47
64
headers : {
48
65
"content-length" : / u n d e f i n e d / ,
@@ -58,7 +75,13 @@ describe("middleware-content-length", () => {
58
75
} ) ;
59
76
60
77
it ( "should add content-length if body present" , async ( ) => {
61
- const client = new S3 ( { region : "us-west-2" } ) ;
78
+ const client = new S3 ( {
79
+ region : "us-west-2" ,
80
+ credentials : {
81
+ accessKeyId : "INTEG" ,
82
+ secretAccessKey : "INTEG" ,
83
+ } ,
84
+ } ) ;
62
85
requireRequestsFrom ( client ) . toMatch ( {
63
86
headers : {
64
87
"content-length" : / 4 / ,
@@ -77,7 +100,13 @@ describe("middleware-content-length", () => {
77
100
78
101
describe ( XRay . name , ( ) => {
79
102
it ( "should add content-length if body present" , async ( ) => {
80
- const client = new XRay ( { region : "us-west-2" } ) ;
103
+ const client = new XRay ( {
104
+ region : "us-west-2" ,
105
+ credentials : {
106
+ accessKeyId : "INTEG" ,
107
+ secretAccessKey : "INTEG" ,
108
+ } ,
109
+ } ) ;
81
110
requireRequestsFrom ( client ) . toMatch ( {
82
111
headers : {
83
112
"content-length" : / 2 4 / ,
0 commit comments