Skip to content

Commit

Permalink
Merge pull request #12 from omniphx/master
Browse files Browse the repository at this point in the history
HttpCalloutMock can use injected properties
  • Loading branch information
joeferraro committed Jun 8, 2015
2 parents cdd1927 + ffd132b commit e714d1b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ApexClass/HttpCalloutMock.cls
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ public class {{ api_name }} implements HttpCalloutMock {
}

public HTTPResponse respond(HTTPRequest req) {
//System.assertEquals('http://api.salesforce.com/foo/bar', req.getEndpoint());
//System.assertEquals('GET', req.getMethod());

// Create a fake response

HttpResponse res = new HttpResponse();
res.setHeader('Content-Type', 'application/json');
res.setBody('{"foo":"bar"}');
res.setStatusCode(200);
for(String key : this.responseHeaders.keySet()){
res.setHeader(key, this.responseHeaders.get(key));
}
res.setBody(this.body);
res.setStatusCode(this.code);
res.setStatus(this.status);
return res;
}

Expand Down

0 comments on commit e714d1b

Please sign in to comment.