File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
lua/rest-nvim/client/curl Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 161161--- @private
162162local builder = {}
163163
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+
164181--- @param method string
165182--- @return string[] args
166183function builder .method (method )
@@ -272,6 +289,7 @@ function builder.build(req, ignore_stats)
272289 end
273290 end
274291 insert (args , req .url )
292+ insert (args , builder .extras (req ))
275293 insert (args , builder .method (req .method ))
276294 insert (args , builder .headers (req .headers ))
277295 insert (args , builder .cookies (req .cookies ))
You can’t perform that action at this time.
0 commit comments