Skip to content

[Question] POST request WithHeaders #129

Answered by cchung100m
cchung100m asked this question in Q&A
Discussion options

You must be logged in to vote

Hi all,

Using WithHeaders is correct because I find the root cause is that the return type of request is not json object but text format.

	r := e.POST("/rest/login").
		WithClient(client).
		WithHeaders(map[string]string{
			"Content-Type": "application/json",
			"login":        username,
			"passHash":     hexStr,
		}).
		Expect().
		Status(http.StatusOK).Text().Raw()

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gavv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #129 on November 12, 2022 20:28.