You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,64 @@ All notable changes to this project will be documented in this file.
4
4
5
5
> 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.
6
6
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
+
7
65
## 1.1.1 (2024-11-25) First Minor Release!
8
66
9
67
There should be no breaking changes, but this is being released as a minor release instead of a patch.
Copy file name to clipboardExpand all lines: README.md
+60Lines changed: 60 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -817,6 +817,66 @@ connections.add( {
817
817
} );
818
818
```
819
819
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++"
0 commit comments