Skip to content

Commit 3179c79

Browse files
committed
Make http headers case-insensitive
1 parent 7b407f4 commit 3179c79

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ftplugin/rest.vim

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,21 +194,20 @@ endfunction
194194
"
195195
function! s:ParseHeaders(start, end)
196196
let contentTypeOpt = s:GetOpt('vrc_header_content_type', 'application/json')
197-
let headers = {'Content-Type': contentTypeOpt}
197+
let headers = {'content-type': contentTypeOpt}
198198
if (a:end < a:start)
199199
return headers
200200
endif
201201

202202
let lineBuf = getline(a:start, a:end)
203-
let hasContentType = 0
204203
for line in lineBuf
205204
let line = s:StrTrim(line)
206205
if line ==? '' || line =~? s:vrc_comment_delim || line =~? '\v^--?\w+'
207206
continue
208207
endif
209208
let sepIdx = stridx(line, ':')
210209
if sepIdx > -1
211-
let key = s:StrTrim(line[0:sepIdx - 1])
210+
let key = tolower(s:StrTrim(line[0:sepIdx - 1]))
212211
let headers[key] = s:StrTrim(line[sepIdx + 1:])
213212
endif
214213
endfor

0 commit comments

Comments
 (0)