File tree 1 file changed +18
-0
lines changed
lua/rest-nvim/client/curl
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 161
161
--- @private
162
162
local builder = {}
163
163
164
+ --- @param req rest.Request
165
+ --- @return string[] args
166
+ function builder .extras (req )
167
+ local args = {}
168
+ local upper = function (str )
169
+ return string.gsub (" " .. str , " %W%l" , string.upper ):sub (2 )
170
+ end
171
+ for key , values in pairs (req .headers ) do
172
+ for _ , value in ipairs (values ) do
173
+ if upper (key ) == " Accept-Encoding" and string.find (value , " gzip" ) then
174
+ vim .list_extend (args , { " --compressed" })
175
+ end
176
+ end
177
+ end
178
+ return args
179
+ end
180
+
164
181
--- @param method string
165
182
--- @return string[] args
166
183
function builder .method (method )
@@ -272,6 +289,7 @@ function builder.build(req, ignore_stats)
272
289
end
273
290
end
274
291
insert (args , req .url )
292
+ insert (args , builder .extras (req ))
275
293
insert (args , builder .method (req .method ))
276
294
insert (args , builder .headers (req .headers ))
277
295
insert (args , builder .cookies (req .cookies ))
You can’t perform that action at this time.
0 commit comments