@bifravst/http-api-mock 3.0.7 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/{npm → dist}/cdk/http-api-mock.js +1 -1
- package/dist/package.json +103 -0
- package/package.json +5 -7
- package/cdk/App.ts +0 -26
- package/cdk/Stack.ts +0 -66
- package/cdk/http-api-mock.ts +0 -109
- package/cdk/resources/HttpApiMock.ts +0 -117
- package/cdk/resources/checkMatchingQueryParams.spec.ts +0 -67
- package/cdk/resources/checkMatchingQueryParams.ts +0 -40
- package/cdk/resources/http-api-mock-lambda.ts +0 -147
- package/cdk/resources/splitMockResponse.spec.ts +0 -17
- package/cdk/resources/splitMockResponse.ts +0 -25
- package/npm/cdk/App.ts +0 -26
- package/npm/cdk/Stack.ts +0 -66
- package/npm/cdk/http-api-mock.ts +0 -109
- package/npm/cdk/resources/HttpApiMock.ts +0 -117
- package/npm/cdk/resources/checkMatchingQueryParams.spec.ts +0 -67
- package/npm/cdk/resources/checkMatchingQueryParams.ts +0 -40
- package/npm/cdk/resources/http-api-mock-lambda.ts +0 -147
- package/npm/cdk/resources/splitMockResponse.spec.ts +0 -17
- package/npm/cdk/resources/splitMockResponse.ts +0 -25
- package/npm/package.json +0 -105
- package/src/mock.spec.ts +0 -52
- package/src/mock.ts +0 -61
- package/src/parseMockRequest.spec.ts +0 -30
- package/src/parseMockRequest.ts +0 -35
- package/src/parseMockResponse.spec.ts +0 -27
- package/src/parseMockResponse.ts +0 -35
- package/src/randomString.ts +0 -7
- package/src/requests.ts +0 -28
- package/src/responses.ts +0 -50
- package/src/sortQueryString.spec.ts +0 -38
- package/src/sortQueryString.ts +0 -26
- /package/{npm → dist}/cdk/App.d.ts +0 -0
- /package/{npm → dist}/cdk/App.js +0 -0
- /package/{npm → dist}/cdk/Stack.d.ts +0 -0
- /package/{npm → dist}/cdk/Stack.js +0 -0
- /package/{npm → dist}/cdk/http-api-mock.d.ts +0 -0
- /package/{npm → dist}/cdk/resources/HttpApiMock.d.ts +0 -0
- /package/{npm → dist}/cdk/resources/HttpApiMock.js +0 -0
- /package/{npm → dist}/cdk/resources/checkMatchingQueryParams.d.ts +0 -0
- /package/{npm → dist}/cdk/resources/checkMatchingQueryParams.js +0 -0
- /package/{npm → dist}/cdk/resources/checkMatchingQueryParams.spec.d.ts +0 -0
- /package/{npm → dist}/cdk/resources/checkMatchingQueryParams.spec.js +0 -0
- /package/{npm → dist}/cdk/resources/http-api-mock-lambda.d.ts +0 -0
- /package/{npm → dist}/cdk/resources/http-api-mock-lambda.js +0 -0
- /package/{npm → dist}/cdk/resources/splitMockResponse.d.ts +0 -0
- /package/{npm → dist}/cdk/resources/splitMockResponse.js +0 -0
- /package/{npm → dist}/cdk/resources/splitMockResponse.spec.d.ts +0 -0
- /package/{npm → dist}/cdk/resources/splitMockResponse.spec.js +0 -0
- /package/{npm → dist}/e2e.spec.d.ts +0 -0
- /package/{npm → dist}/e2e.spec.js +0 -0
- /package/{npm → dist}/src/mock.d.ts +0 -0
- /package/{npm → dist}/src/mock.js +0 -0
- /package/{npm → dist}/src/mock.spec.d.ts +0 -0
- /package/{npm → dist}/src/mock.spec.js +0 -0
- /package/{npm → dist}/src/parseMockRequest.d.ts +0 -0
- /package/{npm → dist}/src/parseMockRequest.js +0 -0
- /package/{npm → dist}/src/parseMockRequest.spec.d.ts +0 -0
- /package/{npm → dist}/src/parseMockRequest.spec.js +0 -0
- /package/{npm → dist}/src/parseMockResponse.d.ts +0 -0
- /package/{npm → dist}/src/parseMockResponse.js +0 -0
- /package/{npm → dist}/src/parseMockResponse.spec.d.ts +0 -0
- /package/{npm → dist}/src/parseMockResponse.spec.js +0 -0
- /package/{npm → dist}/src/randomString.d.ts +0 -0
- /package/{npm → dist}/src/randomString.js +0 -0
- /package/{npm → dist}/src/requests.d.ts +0 -0
- /package/{npm → dist}/src/requests.js +0 -0
- /package/{npm → dist}/src/responses.d.ts +0 -0
- /package/{npm → dist}/src/responses.js +0 -0
- /package/{npm → dist}/src/sortQueryString.d.ts +0 -0
- /package/{npm → dist}/src/sortQueryString.js +0 -0
- /package/{npm → dist}/src/sortQueryString.spec.d.ts +0 -0
- /package/{npm → dist}/src/sortQueryString.spec.js +0 -0
package/src/sortQueryString.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { URLSearchParams } from 'node:url'
|
|
2
|
-
|
|
3
|
-
export const sortQueryString = (mockUrl: string): string => {
|
|
4
|
-
const [host, query] = mockUrl.split('?', 2) as [string, string | undefined]
|
|
5
|
-
if (query === undefined || (query?.length ?? 0) === 0) return host
|
|
6
|
-
return `${host}?${sortQuery(new URLSearchParams(query))}`
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const sortQuery = (
|
|
10
|
-
query: URLSearchParams | Record<string, string>,
|
|
11
|
-
): string => {
|
|
12
|
-
const params: string[][] = []
|
|
13
|
-
if (query instanceof URLSearchParams) {
|
|
14
|
-
query.forEach((v, k) => {
|
|
15
|
-
params.push([k, v])
|
|
16
|
-
})
|
|
17
|
-
} else {
|
|
18
|
-
params.push(...Object.entries(query))
|
|
19
|
-
}
|
|
20
|
-
params.sort(([k1], [k2]) => (k1 ?? '').localeCompare(k2 ?? ''))
|
|
21
|
-
const sortedParams = new URLSearchParams()
|
|
22
|
-
for (const [k, v] of params) {
|
|
23
|
-
sortedParams.append(k as string, v as string)
|
|
24
|
-
}
|
|
25
|
-
return sortedParams.toString()
|
|
26
|
-
}
|
|
File without changes
|
/package/{npm → dist}/cdk/App.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|