Permalink
Browse files

Add helper to set Accept header to application/json

  • Loading branch information...
kevinsawicki committed Mar 25, 2012
1 parent e252208 commit f68fab59dfba85b3ae5c6df71e9f894382f6d65f
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/src/main/java/com/github/kevinsawicki/http/HttpRequest.java
@@ -217,6 +217,8 @@
private static final String CONTENT_TYPE_FORM = "application/x-www-form-urlencoded";
+ private static final String CONTENT_TYPE_JSON = "application/json";
+
/**
* <p>
* Encodes and decodes to and from Base64 notation.
@@ -1722,6 +1724,15 @@ public HttpRequest accept(final String value) {
return header(HEADER_ACCEPT, value);
}
+ /**
+ * Set the 'Accept' header to 'application/json'
+ *
+ * @return this request
+ */
+ public HttpRequest acceptJson() {
+ return accept(CONTENT_TYPE_JSON);
+ }
+
/**
* Copy from input stream to output stream
*

0 comments on commit f68fab5

Please sign in to comment.