File tree Expand file tree Collapse file tree 3 files changed +19
-6
lines changed
Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -130,30 +130,30 @@ So a perfect request would look like this:
130130@variables1 = value1
131131
132132
133+ ### REQUEST_NAME_ONE
134+
133135# This is a comment
134136# This is another comment
135137# @someother metatag
136- # @name REQUEST_NAME_ONE
137138GET http://localhost:8080/api/v1/health HTTP/1.1
138139Content-Type: application/json
139140
140141{
141142 "key": "value"
142143}
143-
144- ###
145144```
146145
147146or this:
148147
149148``` http
150- @variables1=value1
149+ @variables1 = value1
150+
151151
152+ ### REQUEST_NAME_ONE
152153
153154# This is a comment
154155# This is another comment
155156# @someother metatag
156- # @name REQUEST_NAME_ONE
157157GET http://localhost:8080/api/v1/health HTTP/2
158158content-type: application/json
159159
Original file line number Diff line number Diff line change 11{
22 "name" : " @mistweaverco/kulala-fmt" ,
3- "version" : " 2.9.1 " ,
3+ "version" : " 2.10.0 " ,
44 "type" : " module" ,
55 "scripts" : {
66 "build" : " rollup -c" ,
Original file line number Diff line number Diff line change @@ -279,6 +279,14 @@ const parse = (content: string): Document | null => {
279279 block . metadata . length > 0 ||
280280 block . comments . length > 0
281281 ) {
282+ // sort headers by key
283+ block . request ?. headers . sort ( ( a , b ) => {
284+ return a . key . localeCompare ( b . key ) ;
285+ } ) ;
286+ // sort metadata by key
287+ block . metadata . sort ( ( a , b ) => {
288+ return a . key . localeCompare ( b . key ) ;
289+ } ) ;
282290 blocks . push ( block ) ;
283291 }
284292 } ) ;
@@ -308,6 +316,11 @@ const parse = (content: string): Document | null => {
308316 }
309317 } ) ;
310318
319+ // sort variables by key
320+ variables . sort ( ( a , b ) => {
321+ return a . key . localeCompare ( b . key ) ;
322+ } ) ;
323+
311324 return { blocks, variables } ;
312325} ;
313326
You can’t perform that action at this time.
0 commit comments