@keq-request/headers 5.0.0-alpha.7
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/CHANGELOG.md +77 -0
- package/LICENSE +21 -0
- package/README.md +70 -0
- package/jest.config.cts +10 -0
- package/package.json +46 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 5.0.0-alpha.7
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 5175097: **BREAKING CHANGE:** group all packages under the @keq-request scope
|
|
8
|
+
|
|
9
|
+
- keq-cache => @keq-request/cache
|
|
10
|
+
- keq-headers => @keq-request/headers
|
|
11
|
+
- keq-cli => @keq-request/cli
|
|
12
|
+
- keq-url => @keq-request/url
|
|
13
|
+
- keq-exception => @keq-request/exception
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [153244f]
|
|
18
|
+
- Updated dependencies [153244f]
|
|
19
|
+
- Updated dependencies [153244f]
|
|
20
|
+
- Updated dependencies [153244f]
|
|
21
|
+
- Updated dependencies [153244f]
|
|
22
|
+
- Updated dependencies [7ff2162]
|
|
23
|
+
- Updated dependencies [153244f]
|
|
24
|
+
- Updated dependencies [153244f]
|
|
25
|
+
- Updated dependencies [153244f]
|
|
26
|
+
- Updated dependencies [153244f]
|
|
27
|
+
- Updated dependencies [153244f]
|
|
28
|
+
- keq@5.0.0-alpha.7
|
|
29
|
+
|
|
30
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
31
|
+
|
|
32
|
+
## [2.0.4](https://github.com/keq-request/keq-headers/compare/v2.0.3...v2.0.4) (2024-05-21)
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
- setHeaders should override but not ([fd0bc52](https://github.com/keq-request/keq-headers/commit/fd0bc52c995efcc21a33461aa862b0b8db87efe3))
|
|
37
|
+
|
|
38
|
+
## [2.0.3](https://github.com/keq-request/keq-headers/compare/v2.0.2...v2.0.3) (2024-05-13)
|
|
39
|
+
|
|
40
|
+
### Bug Fixes
|
|
41
|
+
|
|
42
|
+
- setHeaders/appendHeaders causing multiple requests to be sent ([1dba50a](https://github.com/keq-request/keq-headers/commit/1dba50a9dc29cc4e505a648ca8d2f24b731580aa))
|
|
43
|
+
|
|
44
|
+
### Performance Improvements
|
|
45
|
+
|
|
46
|
+
- add middleware function name ([4c4b411](https://github.com/keq-request/keq-headers/commit/4c4b4112047e7fc85a146461b7d49acdd1de4f17))
|
|
47
|
+
|
|
48
|
+
### [2.0.2](https://www.github.com/keq-request/keq-headers/compare/v2.0.1...v2.0.2) (2024-05-09)
|
|
49
|
+
|
|
50
|
+
### Bug Fixes
|
|
51
|
+
|
|
52
|
+
- insertHeader/insertHeaders cannot insert header ([e0efea4](https://www.github.com/keq-request/keq-headers/commit/e0efea422b4daed19958bbf042f29a8eddd184d5))
|
|
53
|
+
|
|
54
|
+
### [2.0.1](https://www.github.com/keq-request/keq-headers/compare/v2.0.0...v2.0.1) (2023-10-30)
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
- missing peer deps ([90d6151](https://www.github.com/keq-request/keq-headers/commit/90d61512438c8eaf92ef9167af91724b11cbf022))
|
|
59
|
+
- wrong deps ([49a197d](https://www.github.com/keq-request/keq-headers/commit/49a197d77f632c9ce1bb46ab0f9778517e2372e0))
|
|
60
|
+
|
|
61
|
+
## [2.0.0](https://www.github.com/keq-request/keq-headers/compare/v1.0.1...v2.0.0) (2023-10-30)
|
|
62
|
+
|
|
63
|
+
### ⚠ BREAKING CHANGES
|
|
64
|
+
|
|
65
|
+
- drop support keq@1
|
|
66
|
+
|
|
67
|
+
### Features
|
|
68
|
+
|
|
69
|
+
- support keq@2 ([0731cd5](https://www.github.com/keq-request/keq-headers/commit/0731cd543ecc9a2fe7b7e80d6022582584b62c53))
|
|
70
|
+
|
|
71
|
+
### [1.0.1](https://www.github.com/keq-request/keq-headers/compare/v1.0.0...v1.0.1) (2021-07-09)
|
|
72
|
+
|
|
73
|
+
### Bug Fixes
|
|
74
|
+
|
|
75
|
+
- cannot insert header ([ec6800e](https://www.github.com/keq-request/keq-headers/commit/ec6800ef33c0e2c18705cf56c53e490617b86d10))
|
|
76
|
+
|
|
77
|
+
## 1.0.0 (2021-04-26)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Val.istar.Guo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<!-- title -->
|
|
2
|
+
<p align="center" style="padding-top: 41px">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/keq-request/keq/refs/heads/master/images/logo.svg" width="121" alt="logo" />
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
<h2 align="center" style="text-align: center">KEQ-HEADERS</h2>
|
|
7
|
+
<!-- title -->
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/keq-headers)
|
|
10
|
+
[](https://www.npmjs.com/package/keq-headers)
|
|
11
|
+
[](https://www.npmjs.com/package/keq-headers)
|
|
12
|
+
[](https://www.npmjs.com/package/keq-headers)
|
|
13
|
+
[](https://codecov.io/gh/keq-request/keq-headers)
|
|
14
|
+
|
|
15
|
+
[Document EN]: https://keq-request.github.io/guide/libraries/keq-headers
|
|
16
|
+
[Document CN]: https://keq-request.github.io/zh/guide/libraries/keq-headers
|
|
17
|
+
|
|
18
|
+
[**Document**][Document EN] | [**中文文档**][Document CN]
|
|
19
|
+
|
|
20
|
+
Set/Append headers to request.
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { request } from "keq";
|
|
26
|
+
import {
|
|
27
|
+
setHeader,
|
|
28
|
+
setHeaders,
|
|
29
|
+
appendHeader,
|
|
30
|
+
appendHeaders,
|
|
31
|
+
insertHeader,
|
|
32
|
+
insertHeaders,
|
|
33
|
+
} from "keq-headers";
|
|
34
|
+
|
|
35
|
+
request
|
|
36
|
+
.use(setHeader("x-user-name", "Kerry"))
|
|
37
|
+
.use(appendHeader("x-user-name", "Marry"))
|
|
38
|
+
.use(insertHeader("x-user-name", "J"))
|
|
39
|
+
.use(
|
|
40
|
+
setHeaders({
|
|
41
|
+
"x-user-name": "Kerry",
|
|
42
|
+
"x-user-id": "1",
|
|
43
|
+
})
|
|
44
|
+
)
|
|
45
|
+
.use(
|
|
46
|
+
appendHeaders({
|
|
47
|
+
"x-user-name": "Marray",
|
|
48
|
+
"x-user-id": "1",
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
.use(
|
|
52
|
+
insertHeaders({
|
|
53
|
+
"x-user-name": "J",
|
|
54
|
+
"x-user-id": 1,
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
| **Middleware** | **Description** |
|
|
60
|
+
| :------------- | :------------------------------------------------------------------------- |
|
|
61
|
+
| setHeader | Set a header.If it already exists, the original value will be overwritten. |
|
|
62
|
+
| setHeaders | Set headers.If it already exists, the original value will be overwritten. |
|
|
63
|
+
| appendHeader | Append a header. |
|
|
64
|
+
| appendHeaders | Append headers. |
|
|
65
|
+
| insertHeader | Set a header, if it isn't existed. |
|
|
66
|
+
| insertHeaders | Set headers, if it isn't existed. |
|
|
67
|
+
|
|
68
|
+
## Contributing & Development
|
|
69
|
+
|
|
70
|
+
If there is any doubt, it is very welcome to discuss the issue together.
|
package/jest.config.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Config } from 'jest'
|
|
2
|
+
import { pathsToModuleNameMapper } from 'ts-jest'
|
|
3
|
+
import { compilerOptions } from './tsconfig.json'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
7
|
+
export default async (): Promise<Config> => ({
|
|
8
|
+
preset: 'ts-jest',
|
|
9
|
+
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/src', useESM: true }),
|
|
10
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@keq-request/headers",
|
|
3
|
+
"version": "5.0.0-alpha.7",
|
|
4
|
+
"description": "Set/Append headers to request.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"keq",
|
|
7
|
+
"header",
|
|
8
|
+
"headers",
|
|
9
|
+
"set",
|
|
10
|
+
"append",
|
|
11
|
+
"insert"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/keq-request/keq#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/keq-request/keq/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+ssh://git@github.com/keq-request/keq.git"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "Val.istar.Guo <val.istar.guo@gmail.com>",
|
|
23
|
+
"main": "dist/index.js",
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"require": "./dist/index.js",
|
|
29
|
+
"import": "./dist/index.mjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^20.19.24",
|
|
34
|
+
"keq": "5.0.0-alpha.7",
|
|
35
|
+
"@keq-request/test": "5.0.0-alpha.7"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"keq": "^5.0.0-alpha.7"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup",
|
|
42
|
+
"dev": "tsup --watch",
|
|
43
|
+
"test": "jest",
|
|
44
|
+
"test:update": "jest -u"
|
|
45
|
+
}
|
|
46
|
+
}
|