Package com.google.appengine.api.urlfetch

Examples of com.google.appengine.api.urlfetch.HTTPHeader


   @Test
   void testConvertWithHeaders() throws IOException {
      HTTPResponse gaeResponse = createMock(HTTPResponse.class);
      expect(gaeResponse.getResponseCode()).andReturn(200);
      List<HTTPHeader> headers = Lists.newArrayList();
      headers.add(new HTTPHeader(HttpHeaders.CONTENT_TYPE, "text/xml"));
      expect(gaeResponse.getHeaders()).andReturn(headers);
      expect(gaeResponse.getContent()).andReturn(null).atLeastOnce();
      replay(gaeResponse);
      HttpResponse response = req.apply(gaeResponse);
      assertEquals(response.getStatusCode(), 200);
View Full Code Here


   @Test
   void testConvertWithContent() throws IOException {
      HTTPResponse gaeResponse = createMock(HTTPResponse.class);
      expect(gaeResponse.getResponseCode()).andReturn(200);
      List<HTTPHeader> headers = Lists.newArrayList();
      headers.add(new HTTPHeader(HttpHeaders.CONTENT_TYPE, "text/xml"));
      expect(gaeResponse.getHeaders()).andReturn(headers);
      expect(gaeResponse.getContent()).andReturn("hello".getBytes()).atLeastOnce();
      replay(gaeResponse);
      HttpResponse response = req.apply(gaeResponse);
      assertEquals(response.getStatusCode(), 200);
View Full Code Here

  @Inject Metrics metrics;

  public void send(String from, String to, String body, String inReplyTo, String references) {
    try {
      HTTPRequest request = new HTTPRequest(new URL(SENDGRID_SEND_URL), HTTPMethod.POST);
      request.addHeader(new HTTPHeader(CONTENT_TYPE, FORM_UTF8_MIME));
      request.setPayload(encodeQuery(new ImmutableMap.Builder<String, String>()
          .put("api_user", apiUser)
          .put("api_key", apiKey)
          .put("to", to)
          .put("from", from)
View Full Code Here

TOP

Related Classes of com.google.appengine.api.urlfetch.HTTPHeader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.