Skip to content

Instantly share code, notes, and snippets.

@sumitasok
Last active May 17, 2018 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sumitasok/202ee843ba8b94a9a2c16d4cef1a614e to your computer and use it in GitHub Desktop.
Save sumitasok/202ee843ba8b94a9a2c16d4cef1a614e to your computer and use it in GitHub Desktop.
Snippet to fake a web response for testing the response.
req = RestClient::Request.new(url: "www.google.com", method: 'get')
net_http_resp = Net::HTTPResponse.new(1.0, 200, "OK")
net_http_resp.add_field 'Set-Cookie', 'Monster'
resp = RestClient::Response.create(response_body.to_json, net_http_resp, req)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment