Skip to content

How to display the obtained json data as veb's json data in the simplest way #21830

Closed Answered by Avey777
Avey777 asked this question in Questions and Answers
Discussion options

You must be logged in to vote

@["/1688_detail/";get;post]
pub fn (app &App) fetch_1688_detail(mut ctx Context,offer_id string) veb.Result {
req_body := query_product_detail(offer_id) or { return ctx.json({"code": "101", "msg": "offerid 必填"})}
println(req_body)
ctx.set_content_type('text/plain; charset=utf-8')
return ctx.text(req_body)
}

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Avey777
Comment options

Comment options

You must be logged in to vote
1 reply
@Avey777
Comment options

Answer selected by Avey777
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant