get request body
438482
@Override
    public byte[] getBody() throws AuthFailureError {
        if (mOutput == null) {
            openOutput();
        }
        try {
            if (mMultipart) {

                mOutput.write(CRLF + "--" + BOUNDARY + "--" + CRLF);
            }
            return mOutput.toByteArray();
        } catch (IOException e) {
            e.printStackTrace();
            return mOutput.toByteArray();
        } finally {
            try {
                mOutput.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            mOutput = null;
        }

    }
1319846
def _get_request(self, url, headers, params=None):
        
        return self._session.get(url, headers=headers, params=params)
180834
protected function formattedRequestBody()
    {
        if (isset($this->payload['options']['body_format']) && $this->payload['options']['body_format'] == 'json') {
            return json_encode($this->payload['parameters']);
        }

        return http_build_query($this->payload['parameters']);
    }
1303629
def body(cls, description=None, default=None, resource=DefaultResource, **options):
        
        return cls('body', In.Body, None, resource, description, required=True,
                   default=default, **options)
1187058
public static Object getRequestBody(PageContext pc, boolean deserialized, Object defaultValue) {

	HttpServletRequest req = pc.getHttpServletRequest();

	MimeType contentType = getContentType(pc);
	String strContentType = contentType == MimeType.ALL ? null : contentType.toString();
	Charset cs = getCharacterEncoding(pc, req);

	boolean isBinary = !(strContentType == null || HTTPUtil.isTextMimeType(contentType) || strContentType.toLowerCase().startsWith("application/x-www-form-urlencoded"));

	if (req.getContentLength() > -1) {
	    ServletInputStream is = null;
	    try {
		byte[] data = IOUtil.toBytes(is = req.getInputStream());// new byte[req.getContentLength()];
		Object obj = NULL;

		if (deserialized) {
		    int format = MimeType.toFormat(contentType, -1);
		    obj = toObject(pc, data, format, cs, obj);
		}
		if (obj == NULL) {
		    if (isBinary) obj = data;
		    else obj = toString(data, cs);
		}

		return obj;
	    }
	    catch (Exception e) {
		pc.getConfig().getLog("application").error("request", e);
		return defaultValue;
	    }
	    finally {
		IOUtil.closeEL(is);
	    }
	}

	return defaultValue;
    }
721315
function(request) {
  var options = {};

  if (request.getQueryParameters()) {
    options.query = request.getQueryParameters();
  }

  if (
    request.getHeaders() &&
    request.getHeaders()['Content-Type'] === 'application/json'
  ) {
    options.data = JSON.stringify(request.getBodyParameters());
  } else if (request.getBodyParameters()) {
    options.data = request.getBodyParameters();
  }

  if (request.getHeaders()) {
    options.headers = request.getHeaders();
  }
  return options;
}
760065
def get_body_arguments(self, name: str, strip: bool = True) -> List[str]:
        
        return self._get_arguments(name, self.request.body_arguments, strip)
870009
function getErrorFromBody(body, statusCode, opts) {
  if (typeof body === 'string') {
    try {
      body = JSON.parse(body)
    } catch (e) {
      const stringBody = body
      body = {}
      body.response = stringBody
    }
  }
  // hide token from logs
  if (opts && opts.headers && opts.headers.Authorization) {
    opts.headers.Authorization = 'Token **********'
  }
  body.statusCode = statusCode
  // log the request options to help debugging
  body.request = opts
  if (body.request && body.request.body && Buffer.isBuffer(body.request.body)) {
    body.request.body = '<Buffer...>'
  }
  return new Error(JSON.stringify(body, null, '  '))
}
923533
def get_fetch_response(self, raw):
        """"""
        p = Payload(raw)
        p._body = p.body
        return p
757228
private String getRequestContent(HttpRequest request, String body) {
        StringBuilder builder = new StringBuilder();
        
        builder.append(request.getMethod());
        builder.append(" ");
        builder.append(request.getURI());
        builder.append(NEWLINE);
        
        appendHeaders(request.getHeaders(), builder);
        
        builder.append(NEWLINE);
        builder.append(body);
        
        return builder.toString(); 
    }
847754
function getBodyAsBuffer(body, encoding) {
  return body instanceof Buffer
    ? body
    : Buffer.from(`${body || ''}`, normalizeBodyEncoding(encoding));
}
241082
def __GetRequestField(self, method_description, body_type):
        """"""
        body_field_name = self.__BodyFieldName(body_type)
        if body_field_name in method_description.get('parameters', {}):
            body_field_name = self.__names.FieldName(
                '%s_resource' % body_field_name)
        # It's exceedingly unlikely that we'd get two name collisions, which
        # means it's bound to happen at some point.
        while body_field_name in method_description.get('parameters', {}):
            body_field_name = self.__names.FieldName(
                '%s_body' % body_field_name)
        return body_field_name
356364
def get_body(self):
        """"""

        if self.is_multipart():
            # get the plain text version only
            text_parts = [part
                          for part in typed_subpart_iterator(self,
                                                             'text',
                                                             'plain')]
            body = []
            for part in text_parts:
                charset = get_charset(part, get_charset(self))
                body.append(unicode(part.get_payload(decode=True),
                                    charset,
                                    "replace"))

            return u"\n".join(body).strip()

        else:   # if it is not multipart, the payload will be a string
                # representing the message body
            body = unicode(self.get_payload(decode=True),
                           get_charset(self),
                           "replace")
            return body.strip()
607101
public function body()
	{
		$msg = $this->getMessage();
		
		if (422 == $this->getCode() && !empty($msg)) {
			$this->extra['errors'] = json_decode($msg, true);
			$msg = null;
		}
		
		if (empty($msg)) {
			switch ($this->getCode()) {
				case 404:
					$msg = 'Not Found';
					break;
				case 405:
					$msg = 'Method Not Allowed';
					break;
				case 400:
					$msg = 'Bad Request';
					break;
				case 401:
					$msg = 'Unauthorized';
					break;
				case 402:
					$msg = 'Payment Required';
					break;
				case 403:
					$msg = 'Forbidden';
					break;
				case 422:
					$msg = 'Unprocessable Entity';
					break;
				case 410:
					$msg = 'Resource Deleted';
					break;
				case 500:
					$msg = 'Server Error';
					break;
				default:
					$msg = 'Error';
			}
		}
		
		$output = array(
			'status'  => $this->getCode(),
			'message' => $msg,
		);
		
		if (!empty($this->getExtra())) {
			$output = array_merge($output, $this->getExtra());
		}
		
		return $output;
	}
294822
def getBody(self):
        
        data = None
        try:
            data = json.loads(self.request.body)
        except:
            data = json.loads(urllib.unquote_plus(self.request.body))
        return data
926036
function hasBody(req) {
  var encoding = 'transfer-encoding' in req.headers;
  var length = 'content-length' in req.headers && req.headers['content-length'] !== '0';
  return encoding || length;
}
1330536
def getBody(cls, url, method='GET', headers={}, data=None, socket=None, timeout=120):
        
        if not 'User-Agent' in headers:
            headers['User-Agent'] = ['Tensor HTTP checker']

        return cls().request(url, method, headers, data, socket, timeout)