Skip to content

Commit ead3aa2

Browse files
fix(errors): update missing field error text (#85)
1 parent 143c911 commit ead3aa2

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const (
1515
jsonParsingError = "error decoding json response (%s): %s"
1616

1717
// fieldReqMsg is API error stating a field is required.
18-
fieldReqMsg = "This field is required."
18+
fieldReqMsg = "This field may not be blank."
1919
invalidUserMsg = "Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters."
2020
failedLoginMsg = "Unable to log in with provided credentials."
2121
invalidAppNameMsg = "App name can only contain a-z (lowercase), 0-9 and hyphens"

errors_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestErrors(t *testing.T) {
6464
{
6565
res: &http.Response{
6666
StatusCode: 400,
67-
Body: readCloser(`{"username":["This field is required."]}`),
67+
Body: readCloser(`{"username":["This field may not be blank."]}`),
6868
},
6969
expected: ErrInvalidUsername,
7070
},
@@ -85,7 +85,7 @@ func TestErrors(t *testing.T) {
8585
{
8686
res: &http.Response{
8787
StatusCode: 400,
88-
Body: readCloser(`{"password":["This field is required."]}`),
88+
Body: readCloser(`{"password":["This field may not be blank."]}`),
8989
},
9090
expected: ErrMissingPassword,
9191
},
@@ -113,7 +113,7 @@ func TestErrors(t *testing.T) {
113113
{
114114
res: &http.Response{
115115
StatusCode: 400,
116-
Body: readCloser(`{"certificate": ["This field is required."]}`),
116+
Body: readCloser(`{"certificate": ["This field may not be blank."]}`),
117117
},
118118
expected: ErrInvalidCertificate,
119119
},
@@ -127,7 +127,7 @@ func TestErrors(t *testing.T) {
127127
{
128128
res: &http.Response{
129129
StatusCode: 400,
130-
Body: readCloser(`{"key": ["This field is required."]}`),
130+
Body: readCloser(`{"key": ["This field may not be blank."]}`),
131131
},
132132
expected: ErrMissingKey,
133133
},
@@ -148,14 +148,14 @@ func TestErrors(t *testing.T) {
148148
{
149149
res: &http.Response{
150150
StatusCode: 400,
151-
Body: readCloser(`{"public":["This field is required."]}`),
151+
Body: readCloser(`{"public":["This field may not be blank."]}`),
152152
},
153153
expected: ErrMissingKey,
154154
},
155155
{
156156
res: &http.Response{
157157
StatusCode: 400,
158-
Body: readCloser(`{"name": ["This field is required."]}`),
158+
Body: readCloser(`{"name": ["This field may not be blank."]}`),
159159
},
160160
expected: ErrInvalidName,
161161
},
@@ -190,7 +190,7 @@ func TestErrors(t *testing.T) {
190190
{
191191
res: &http.Response{
192192
StatusCode: 400,
193-
Body: readCloser(`{"image":["This field is required."]}`),
193+
Body: readCloser(`{"image":["This field may not be blank."]}`),
194194
},
195195
expected: ErrInvalidImage,
196196
},
@@ -204,7 +204,7 @@ func TestErrors(t *testing.T) {
204204
{
205205
res: &http.Response{
206206
StatusCode: 400,
207-
Body: readCloser(`{"id":["This field is required."]}`),
207+
Body: readCloser(`{"id":["This field may not be blank."]}`),
208208
},
209209
expected: ErrMissingID,
210210
},

0 commit comments

Comments
 (0)