We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently almost every struct has Raw() method, that returns the underlying value.
It would be nice to add to each such struct a complementary Decode() method, that will json-decode underlying value into the argument.
Example:
var m map[string]interface{} m = e.GET("/user"). Expect(). Status(http.StatusOK). JSON(). Object(). Raw()
Is same as:
var m map[string]interface{} e.GET("/user"). Expect(). Status(http.StatusOK). JSON(). Object(). Decode(&m)
This method becomes useful when you want to use specific type for decoding, e.g. struct:
var user User e.GET("/fruits/orange"). Expect(). Status(http.StatusOK). JSON(). Object(). Decode(&user)
BTW, this should give the same result:
var user User e.GET("/fruits/orange"). Expect(). Status(http.StatusOK). JSON(). Decode(&user)
If argument is nil, the method should report failure (AssertUsage). If decoding fails, the method should also report failure (AssertValid).
The new method should be documented and covered with unit tests. Also it should be covered in e2e test (e2e_basic_test.go).
Also we should add example to README.
The text was updated successfully, but these errors were encountered:
@gavv I'd like to give this a shot
Sorry, something went wrong.
Hey @gavv, I'll be getting back to this after Jan 5th cause of my exams
Great, thanks, no hurry
Landed.
Rohith-Raju
Successfully merging a pull request may close this issue.
Currently almost every struct has Raw() method, that returns the underlying value.
It would be nice to add to each such struct a complementary Decode() method, that will json-decode underlying value into the argument.
Example:
Is same as:
This method becomes useful when you want to use specific type for decoding, e.g. struct:
BTW, this should give the same result:
If argument is nil, the method should report failure (AssertUsage). If decoding fails, the method should also report failure (AssertValid).
The new method should be documented and covered with unit tests. Also it should be covered in e2e test (e2e_basic_test.go).
Also we should add example to README.
The text was updated successfully, but these errors were encountered: