Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why use postman test error? #40

Closed
forrestsun opened this issue Aug 15, 2013 · 4 comments
Closed

why use postman test error? #40

forrestsun opened this issue Aug 15, 2013 · 4 comments

Comments

@forrestsun
Copy link

'''go lang
ws.Route(ws.PUT("").To(u.createUser).
Doc("create user").
Param(ws.BodyParameter("User", "User").DataType("User")).
Reads(model.User{})) // from the request

func (u *UserService) createUser(request *restful.Request, response *restful.Response) {
usr := new(model.User)
err := request.ReadEntity(&usr)
if err == nil {
_, err = u.UserLogic.SaveUser(usr)
log.Println(err)
} else {
log.Println("Create user err:", err)
}
}
'''
when I use swagger put data test is ok
when I use chrome rest console tool test is ok
but use chrome postman test report error:
415: Unsupported Media Type

@Moddus
Copy link
Contributor

Moddus commented Aug 15, 2013

Did you set the Header value "Content-Type" to application/json or application/xml depend on your request.
Just click the Button "Headers" ( right top corner ) and there you can set the values.

@forrestsun
Copy link
Author

!^_^ my fault,thank's help

@Moddus
Copy link
Contributor

Moddus commented Aug 15, 2013

No problem. Please, close the ticket :)

@forrestsun
Copy link
Author

close #40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants