Skip to content

Commit f7e82aa

Browse files
author
ChadKluck
committed
Updated changelog and readme for next release
1 parent 08120ed commit f7e82aa

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed

CHANGELOG.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,64 @@ All notable changes to this project will be documented in this file.
44

55
> Note: This project is still in beta. Even though changes are tested and breaking changes are avoided, things may break. The latest 1.0 version is stable. This has moved into the 1.1 version stage which may take a while to stabilize.
66
7+
## 1.1.2 (2025-02-11) Additional Options for Sending Parameters via Query String
8+
9+
- Feature: Added new options to specify how duplicate parameters in a query string should be handled. This allows you to craft your query string to match what your endpoint expects when it parses the query string.
10+
11+
```javascript
12+
connections.add({
13+
method: "POST",
14+
host: "api.chadkluck.net",
15+
path: "/echo/",
16+
headers: headers,
17+
uri: "",
18+
protocol: "https",
19+
body: null,
20+
parameters: {
21+
greeting: "Hello",
22+
planets: ["Earth", "Mars"]
23+
},
24+
options: {
25+
timeout: 8000,
26+
separateDuplicateParameters: false, // default is false
27+
separateDuplicateParametersAppendToKey: "", // "" "[]", or "0++", "1++"
28+
combinedDuplicateParameterDelimiter: ','
29+
}
30+
})
31+
```
32+
33+
By default the query string used for the request will be:
34+
35+
```text
36+
?greeting=Hello&planets=Earth,Mars
37+
```
38+
39+
However, by changing `separateDuplicateParameters` to `true` and `separateDuplicateParametersAppendToKey` to `[]`:
40+
41+
```text
42+
?greeting=Hello&planets[]=Earth&planets[]=Mars
43+
```
44+
45+
You can also append an index to the end of the parameter:
46+
47+
```javascript
48+
options = {
49+
separateDuplicateParameters: true,
50+
separateDuplicateParametersAppendToKey: "0++", // "" "[]", or "0++", "1++"
51+
}
52+
// ?greeting=Hello&planets0=Earth&planets1=Mars
53+
```
54+
55+
Similarly, you can start at index 1 instead of 0:
56+
57+
```javascript
58+
options = {
59+
separateDuplicateParameters: true,
60+
separateDuplicateParametersAppendToKey: "1++", // "" "[]", or "0++", "1++"
61+
}
62+
// ?greeting=Hello&planets1=Earth&planets2=Mars
63+
```
64+
765
## 1.1.1 (2024-11-25) First Minor Release!
866

967
There should be no breaking changes, but this is being released as a minor release instead of a patch.

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,66 @@ connections.add( {
817817
} );
818818
```
819819
820+
### Connections Options
821+
822+
Specify a `timeout` in the connection to pass to the http_get command. Default is `8000`.
823+
824+
Specify how duplicate parameters in a query string should be handled. This allows you to craft your query string to match what your endpoint expects when it parses the query string.
825+
826+
```javascript
827+
connections.add({
828+
method: "POST",
829+
host: "api.chadkluck.net",
830+
path: "/echo/",
831+
headers: headers,
832+
uri: "",
833+
protocol: "https",
834+
body: null,
835+
parameters: {
836+
greeting: "Hello",
837+
planets: ["Earth", "Mars"]
838+
},
839+
options: {
840+
timeout: 8000,
841+
separateDuplicateParameters: false, // default is false
842+
separateDuplicateParametersAppendToKey: "", // "" "[]", or "0++", "1++"
843+
combinedDuplicateParameterDelimiter: ','
844+
}
845+
})
846+
```
847+
848+
By default the query string used for the request will be:
849+
850+
```text
851+
?greeting=Hello&planets=Earth,Mars
852+
```
853+
854+
However, by changing `separateDuplicateParameters` to `true` and `separateDuplicateParametersAppendToKey` to `[]`:
855+
856+
```text
857+
?greeting=Hello&planets[]=Earth&planets[]=Mars
858+
```
859+
860+
You can also append an index to the end of the parameter:
861+
862+
```javascript
863+
options = {
864+
separateDuplicateParameters: true,
865+
separateDuplicateParametersAppendToKey: "0++", // "" "[]", or "0++", "1++"
866+
}
867+
// ?greeting=Hello&planets0=Earth&planets1=Mars
868+
```
869+
870+
Similarly, you can start at index 1 instead of 0:
871+
872+
```javascript
873+
options = {
874+
separateDuplicateParameters: true,
875+
separateDuplicateParametersAppendToKey: "1++", // "" "[]", or "0++", "1++"
876+
}
877+
// ?greeting=Hello&planets1=Earth&planets2=Mars
878+
```
879+
820880
### tools.Timer
821881
822882
In its simplist form we can do the following:

0 commit comments

Comments
 (0)