Created
May 12, 2020 19:01
-
-
Save kyleterry/0543b882facd2efea51b7568885d9b23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SetJSONBody is used to set a request body that is a JSON-encoded value. | |
func (r *Request) SetJSONBody(val interface{}) error { | |
buf, err := json.Marshal(val) | |
if err != nil { | |
return err | |
} | |
r.Obj = val | |
r.BodyBytes = buf | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment