Skip to content

Commit 52631ee

Browse files
sharpnerwwwdata
authored andcommitted
Add failing test for renaming bug
this relates to issue #154
1 parent cf7c978 commit 52631ee

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

api_interfaces_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import (
1313
)
1414

1515
type SomeData struct {
16-
ID string `json:"-"`
17-
Data string
16+
ID string `json:"-"`
17+
Data string
18+
CustomerID string `jsonapi:"name=customerId"`
1819
}
1920

2021
func (s SomeData) GetID() string {
@@ -103,6 +104,14 @@ var _ = Describe("Test interface api type casting", func() {
103104
api.Handler().ServeHTTP(rec, req)
104105
Expect(rec.Code).To(Equal(http.StatusOK))
105106
})
107+
108+
It("reproduce issue with lowercase renaming", func() {
109+
reqBody := strings.NewReader(`{"data": [{"attributes":{"customerId": 2 }, "type": "someDatas"}]}`)
110+
req, err := http.NewRequest("POST", "/v1/someDatas", reqBody)
111+
Expect(err).To(BeNil())
112+
api.Handler().ServeHTTP(rec, req)
113+
Expect(rec.Code).To(Equal(http.StatusCreated))
114+
})
106115
})
107116

108117
var _ = Describe("Test return code behavior", func() {

0 commit comments

Comments
 (0)