mirror of
https://github.com/kataras/iris.git
synced 2026-01-06 11:37:06 +00:00
reorganization of _examples and add some new examples such as iris+groupcache+mysql+docker
Former-commit-id: ed635ee95de7160cde11eaabc0c1dcb0e460a620
This commit is contained in:
24
_examples/request-body/read-yaml/main_test.go
Normal file
24
_examples/request-body/read-yaml/main_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/kataras/iris/v12/httptest"
|
||||
)
|
||||
|
||||
func TestReadYAML(t *testing.T) {
|
||||
app := newApp()
|
||||
e := httptest.New(t, app)
|
||||
|
||||
expectedResponse := `Received: main.product{Invoice:34843, Tax:251.42, Total:4443.52, Comments:"Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338."}`
|
||||
send := `invoice: 34843
|
||||
tax : 251.42
|
||||
total: 4443.52
|
||||
comments: >
|
||||
Late afternoon is best.
|
||||
Backup contact is Nancy
|
||||
Billsmer @ 338-4338.`
|
||||
|
||||
e.POST("/").WithHeader("Content-Type", "application/x-yaml").WithBytes([]byte(send)).Expect().
|
||||
Status(httptest.StatusOK).Body().Equal(expectedResponse)
|
||||
}
|
||||
Reference in New Issue
Block a user