Created
October 18, 2016 19:34
-
-
Save thinkingserious/0fabc5f36d3bb0d5a2447afbdf339931 to your computer and use it in GitHub Desktop.
Example of a Mock HTTP Server
This file contains hidden or 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
package com.sendgrid; | |
import java.io.IOException; | |
import java.util.HashMap; | |
public class MockSendGrid extends SendGrid { | |
Request request; | |
public MockSendGrid(String apiKey) { | |
super(apiKey); | |
} | |
public Response makeCall(Request request) throws IOException { | |
this.request = request; | |
Response response = new Response(); | |
response.statusCode = 200; | |
response.body = "{\"message\":\"success\"}"; | |
response.headers = new HashMap<String, String>(); | |
response.headers.put("Test", "Header"); | |
return response; | |
} | |
public Request getRequest() { | |
return this.request; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment