@keq-request/url 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 +66 -0
- package/LICENSE +21 -0
- package/README.md +67 -0
- package/jest.config.cts +9 -0
- package/package.json +49 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 153244f: **Feat:** setBaseUrl could prefix pathname.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [153244f]
|
|
22
|
+
- Updated dependencies [153244f]
|
|
23
|
+
- Updated dependencies [153244f]
|
|
24
|
+
- Updated dependencies [153244f]
|
|
25
|
+
- Updated dependencies [153244f]
|
|
26
|
+
- Updated dependencies [7ff2162]
|
|
27
|
+
- Updated dependencies [153244f]
|
|
28
|
+
- Updated dependencies [153244f]
|
|
29
|
+
- Updated dependencies [153244f]
|
|
30
|
+
- Updated dependencies [153244f]
|
|
31
|
+
- Updated dependencies [153244f]
|
|
32
|
+
- keq@5.0.0-alpha.7
|
|
33
|
+
|
|
34
|
+
## [2.0.4](https://github.com/keq-request/keq-url/compare/v2.0.3...v2.0.4) (2024-08-09)
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
- port is set to :0 in chrome@70 ([1c1ebfe](https://github.com/keq-request/keq-url/commit/1c1ebfe7e93550003c71a106c4beb8fe51f04cb1))
|
|
39
|
+
|
|
40
|
+
## [2.0.3](https://github.com/keq-request/keq-url/compare/v2.0.2...v2.0.3) (2024-07-20)
|
|
41
|
+
|
|
42
|
+
### Performance Improvements
|
|
43
|
+
|
|
44
|
+
- remove whatwg-url because mosts browsers had support ([29b9e31](https://github.com/keq-request/keq-url/commit/29b9e312a0d25a38824172cad98602a83e4dbb5f))
|
|
45
|
+
|
|
46
|
+
## [2.0.2](https://github.com/keq-request/keq-url/compare/v2.0.1...v2.0.2) (2024-05-13)
|
|
47
|
+
|
|
48
|
+
### Performance Improvements
|
|
49
|
+
|
|
50
|
+
- add middleware function name ([a4bbc81](https://github.com/keq-request/keq-url/commit/a4bbc81cb2edfc1fa589bfb09bdefbfdbebfb2f8))
|
|
51
|
+
|
|
52
|
+
## [2.0.1](https://github.com/keq-request/keq-url/compare/v2.0.0...v2.0.1) (2024-04-26)
|
|
53
|
+
|
|
54
|
+
### Miscellaneous Chores
|
|
55
|
+
|
|
56
|
+
- release 2.0.1 ([7928da9](https://github.com/keq-request/keq-url/commit/7928da931ded536aa26766745213868cbf0ee633))
|
|
57
|
+
|
|
58
|
+
## 2.0.0 (2024-04-26)
|
|
59
|
+
|
|
60
|
+
### Features
|
|
61
|
+
|
|
62
|
+
- first commit ([8545a32](https://github.com/keq-request/keq-url/commit/8545a32b4a0030e9c323c2fc1091d4e9f1f7d849))
|
|
63
|
+
|
|
64
|
+
### Miscellaneous Chores
|
|
65
|
+
|
|
66
|
+
- release 2.0.0 ([db3881b](https://github.com/keq-request/keq-url/commit/db3881b9b1c8e53c0d83644428ed68a7d5edc74e))
|
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,67 @@
|
|
|
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-URL</h2>
|
|
7
|
+
<!-- title -->
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/keq-url)
|
|
10
|
+
[](https://www.npmjs.com/package/keq-url)
|
|
11
|
+
[](https://www.npmjs.com/package/keq-url)
|
|
12
|
+
[](https://www.npmjs.com/package/keq-url)
|
|
13
|
+
[](https://codecov.io/gh/keq-request/keq-url)
|
|
14
|
+
|
|
15
|
+
[Document EN]: https://keq-request.github.io/guide/libraries/keq-url
|
|
16
|
+
[Document CN]: https://keq-request.github.io/zh/guide/libraries/keq-url
|
|
17
|
+
|
|
18
|
+
[**Document**][Document EN] | [**中文文档**][Document CN]
|
|
19
|
+
|
|
20
|
+
[Keq](https://github.com/keq-request/keq) middleware for setting the request url.
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### `setBaseUrl(baseUrl)`
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { request } from "keq";
|
|
28
|
+
import { setBaseUrl, setHost } from "keq-url";
|
|
29
|
+
|
|
30
|
+
request.use(setBaseUrl("http://example.com/api"));
|
|
31
|
+
|
|
32
|
+
await request.get("/test");
|
|
33
|
+
// it will send request to 'http://example.com/api/test'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### `setOrigin(origin)`
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { request } from "keq";
|
|
40
|
+
import { setOrigin } from "keq-url";
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
await request.get("http://test.com/test");
|
|
44
|
+
.use(setOrigin("http://example.com:8080"));
|
|
45
|
+
// it will send request to 'http://example.com:8080/test'
|
|
46
|
+
|
|
47
|
+
// and prefix pathname is also possible
|
|
48
|
+
await request.get("http://test.com/test");
|
|
49
|
+
.use(setOrigin("/api"));
|
|
50
|
+
// it will send request to 'http://test.com:8080/api/test'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `setHost(host)`
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { request } from "keq";
|
|
57
|
+
import { setHost } from "keq-url";
|
|
58
|
+
|
|
59
|
+
request.use(setHost("example.com"));
|
|
60
|
+
|
|
61
|
+
await request.get("http://test.com/test");
|
|
62
|
+
// it will send request to 'http://example.com/test'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Contributing & Development
|
|
66
|
+
|
|
67
|
+
If there is any doubt, it is very welcome to discuss the issue together.
|
package/jest.config.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Config } from 'jest'
|
|
2
|
+
import { pathsToModuleNameMapper } from 'ts-jest'
|
|
3
|
+
import { compilerOptions } from './tsconfig.json'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export default (): Config => ({
|
|
7
|
+
preset: 'ts-jest',
|
|
8
|
+
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/src', useESM: true }),
|
|
9
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@keq-request/url",
|
|
3
|
+
"version": "5.0.0-alpha.7",
|
|
4
|
+
"description": "Set request url",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"request",
|
|
7
|
+
"superagent",
|
|
8
|
+
"fetch",
|
|
9
|
+
"node",
|
|
10
|
+
"nodejs",
|
|
11
|
+
"browser",
|
|
12
|
+
"middleware",
|
|
13
|
+
"middlewares",
|
|
14
|
+
"url"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/keq-request/keq#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/keq-request/keq/issues"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/keq-request/keq.git"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"author": "Val.istar.Guo <val.istar.guo@gmail.com>",
|
|
26
|
+
"types": "dist/index.d.ts",
|
|
27
|
+
"main": "dist/index.js",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"require": "./dist/index.js",
|
|
32
|
+
"import": "./dist/index.mjs"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^20.19.24",
|
|
37
|
+
"keq": "5.0.0-alpha.7",
|
|
38
|
+
"@keq-request/test": "5.0.0-alpha.7"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"keq": "^5.0.0-alpha.7"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsup",
|
|
45
|
+
"dev": "tsup --watch",
|
|
46
|
+
"test": "jest",
|
|
47
|
+
"test:update": "jest -u"
|
|
48
|
+
}
|
|
49
|
+
}
|