if (req.isPost()) { conn.setDoOutput(true); conn.setDoInput(true);
if (req.isPost()) { conn.setDoOutput(true); conn.setDoInput(true);
if (req.isPost()) { HttpPost httppost = new HttpPost(req.url); if (req.payloadString != null) {
if (req.isPost()) { if (req.payloadBytes != null) throw new UnsupportedOperationException( "Raw bytes not currently supported in HTML5.");
if (req.isPost()) { if (req.payloadBytes != null) throw new UnsupportedOperationException( "Raw bytes not currently supported in HTML5.");
@Override protected RFuture<Response> execute(Builder req) { RPromise<Response> result = plat.exec().deferredPromise(); NSMutableURLRequest mreq = new NSMutableURLRequest(); mreq.setURL(new NSURL(req.url)); for (Header header : req.headers) { mreq.setHTTPHeaderField(header.name, header.value); } mreq.setHTTPMethod(req.method()); if (req.isPost()) { mreq.setHTTPHeaderField("Content-type", req.contentType()); if (req.payloadString != null) { try { mreq.setHTTPBody(new NSData(req.payloadString.getBytes("UTF-8"))); } catch (UnsupportedEncodingException uee) { throw new RuntimeException(uee); } } else { mreq.setHTTPBody(new NSData(req.payloadBytes)); } } sendRequest(mreq, result); return result; }
public String method() { return isPost() ? "POST" : "GET"; }
public String method() { return isPost() ? "POST" : "GET"; }