Skip to content

Commit

Permalink
Fix error loading requests with empty header values from history
Browse files Browse the repository at this point in the history
Closes #400
  • Loading branch information
LucasPickering committed Oct 21, 2024
1 parent a4c6aef commit 26aefa0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
- [See docs](https://slumber.lucaspickering.me/book/troubleshooting/shell_completions.html) for more info and a list of supported shells
- Add `slumber gen` alias to `--help` documentation

### Fixed

- Fix error loading requests with empty header values from history [#400](https://github.com/LucasPickering/slumber/issues/400)

## [2.1.0] - 2024-09-27

### Added
Expand Down
5 changes: 4 additions & 1 deletion crates/core/src/db/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ impl<'a> ToSql for SqlWrap<&'a HeaderMap> {

impl FromSql for SqlWrap<HeaderMap> {
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> {
// There's no easy way to re-use the header parsing logic from the http
// crate, so we have to reimplement it ourselves

fn header_line(
input: &mut &[u8],
) -> PResult<(HeaderName, HeaderValue)> {
Expand All @@ -312,7 +315,7 @@ impl FromSql for SqlWrap<HeaderMap> {
HEADER_FIELD_DELIM,
),
terminated(
take_while(1.., |c| c != HEADER_LINE_DELIM)
take_while(0.., |c| c != HEADER_LINE_DELIM)
.try_map(HeaderValue::from_bytes),
HEADER_LINE_DELIM,
),
Expand Down

0 comments on commit 26aefa0

Please sign in to comment.