Trim the newline at the end of raw request file (#438)

This commit is contained in:
Joona Hoikkala 2021-04-27 09:01:15 +03:00 committed by GitHub
parent 25fc4e4b49
commit 33f3ecb65c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -3,6 +3,7 @@
- New - New
- Added a CLI flag to disable the interactive mode - Added a CLI flag to disable the interactive mode
- Changed - Changed
- Do not read the last newline in the end of the raw request file when using -request
- Fixed an issue with storing the matches for recursion jobs - Fixed an issue with storing the matches for recursion jobs
- Fixed the way the "size" is calculated, it should match content-length now - Fixed the way the "size" is calculated, it should match content-length now
- Fixed an issue with header canonicalization when a keyword was just a part of the header name - Fixed an issue with header canonicalization when a keyword was just a part of the header name

View File

@ -489,6 +489,12 @@ func parseRawRequest(parseOpts *ConfigOptions, conf *Config) error {
} }
conf.Data = string(b) conf.Data = string(b)
// Remove newline (typically added by the editor) at the end of the file
if strings.HasSuffix(conf.Data, "\r\n") {
conf.Data = conf.Data[:len(conf.Data)-2]
} else if strings.HasSuffix(conf.Data, "\n") {
conf.Data = conf.Data[:len(conf.Data)-1]
}
return nil return nil
} }