File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -469,8 +469,8 @@ pub fn (mut h Header) delete(key CommonHeader) {
469
469
470
470
// delete_custom deletes all values for a custom header key.
471
471
pub fn (mut h Header) delete_custom (key string ) {
472
- for i, kv in h.data {
473
- if kv .key == key {
472
+ for i := 0 ; i < h.cur_pos; i ++ {
473
+ if h.data[i] .key == key {
474
474
h.data[i] = HeaderKV{key, '' }
475
475
}
476
476
}
Original file line number Diff line number Diff line change @@ -79,6 +79,13 @@ fn test_header_delete_not_existing() {
79
79
// assert h.keys.len == 0
80
80
}
81
81
82
+ fn test_delete_header () {
83
+ mut r := new_request (.get, '' , '' )
84
+ r.header.set (.authorization, 'foo' )
85
+ r.header.delete (.authorization)
86
+ assert r.header.get (.authorization)! == ''
87
+ }
88
+
82
89
fn test_custom_header () {
83
90
mut h := new_header ()
84
91
h.add_custom ('AbC' , 'dEf' )!
You can’t perform that action at this time.
0 commit comments