Guest User

Untitled

a guest
Sep 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. func PostRequest(url string, request interface{}, t reflect.Type) (interface{}, error) {
  2.  
  3. reflectObjectType := reflect.New(t)
  4. result := reflectObjectType.Interface()
  5.  
  6. errBody := json.Unmarshal(body, &result)
  7. if errBody != nil {
  8. return nil, fmt.Errorf("Failed unmarshaling body to type object: %v", err)
  9. }
  10. }
Add Comment
Please, Sign In to add comment