...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package errors
16
17 import (
18 "errors"
19 "testing"
20
21 "github.com/stretchr/testify/assert"
22 )
23
24 func TestParseError(t *testing.T) {
25 err := NewParseError("Content-Type", "header", "application(", errors.New("unable to parse"))
26 assert.EqualValues(t, 400, err.Code())
27 assert.Equal(t, "parsing Content-Type header from \"application(\" failed, because unable to parse", err.Error())
28
29 err = NewParseError("Content-Type", "", "application(", errors.New("unable to parse"))
30 assert.EqualValues(t, 400, err.Code())
31 assert.Equal(t, "parsing Content-Type from \"application(\" failed, because unable to parse", err.Error())
32 }
33
View as plain text