Code example for HttpUriRequest

Methods: setHeader

0
	 * Adds Content-Type and Accepts to JSON 
	 *  
	 * @param request 
	 */ 
	private void addRestHeaders(HttpUriRequest request) {
		request.setHeader("User-Agent", "Android Restful");
 
		if (isNotGetOrDeleteRequest()) 
			request.setHeader("Content-Type", "application/json");
 
		request.setHeader("Accept", "application/json");
	} 
 
	@SuppressLint("DefaultLocale") 
	private boolean isNotGetOrDeleteRequest() { 
		String methodUppercased = requestMethod.toUpperCase();
 
		if (methodUppercased == "GET")
			return false; 
 
		return true;