Get the Content-Type option of a response.

        :return: the Content-Type value or 0 if not specified by the response
963054
def content_type(self):
        
        value = 0
        for option in self.options:
            if option.number == defines.OptionRegistry.CONTENT_TYPE.number:
                value = int(option.value)
        return value
846842
def smart_content_type(self):
        """"""
        content_type = self.content_type
        if content_type in (None, '', 'application/octet-stream'):
            content_type, _ = mimetypes.guess_type(self.name)

        return content_type
856846
def set_response_content_type(self):
        
        if self.response.body:
            ct = self.type
            if self.charset:
                ct += '; charset=' + self.charset
            self.response.headers['Content-Type'] = ct
        elif 'Content-Type' in self.response.headers:
            del self.response.headers['Content-Type']
506447
def content_type(self, response):
        
        if not re_html.match(response.headers.get('Content-Type').decode('utf-8')):
            self.log.warn(
                "Dropped: %s's content is not of type "
                "text/html but %s", response.url, response.headers.get('Content-Type')
            )
            return False
        else:
            return True
1306820
public function get_content_type() {
		$headers = wp_remote_retrieve_headers( $this->response );
		if ( ! $headers ) {
			return;
		}

		if ( ! is_object( $headers ) || ! method_exists( $headers, 'offsetGet' ) ) {
			return;
		}

		return $headers->offsetGet( 'content-type' );
	}
1277502
def get_content_type(obj, field_name=False):
    
    content_type = ContentType.objects.get_for_model(obj)
    if field_name:
        return getattr(content_type, field_name, '')
    return content_type
282139
@Override
    public String getContentType() {
	URLConnection connection = null;
	try {
	    connection = url.openConnection();
	}
	catch (IOException e) {}
	if (connection == null) return DEFAULT_CONTENT_TYPE;

	return connection.getContentType();

    }
351253
function getcontenttype (obj) {
  var header

  if (typeof obj.getHeader === 'function') {
    // res-like
    header = obj.getHeader('content-type')
  } else if (typeof obj.headers === 'object') {
    // req-like
    header = obj.headers && obj.headers['content-type']
  }

  if (typeof header !== 'string') {
    throw new TypeError('content-type header is missing from object')
  }

  return header
}
340634
def _get_response_mime_type(self):
        
        view_name = self.request.view_name
        if view_name != '':
            mime_type = get_registered_mime_type_for_name(view_name)
        else:
            mime_type = None
            acc = None
            for acc in self.request.accept:
                if acc == '*/*':
                    # The client does not care; use the default.
                    mime_type = self.__get_default_response_mime_type()
                    break
                try:
                    mime_type = \
                            get_registered_mime_type_for_string(acc.lower())
                except KeyError:
                    pass
                else:
                    break
            if mime_type is None:
                if not acc is None:
                    # The client specified a MIME type we can not handle; this
                    # is a 406 exception. We supply allowed MIME content
                    # types in the body of the response.
                    headers = \
                        [('Location', self.request.path_url),
                         ('Content-Type', TextPlainMime.mime_type_string),
                         ]
                    mime_strings = get_registered_mime_strings()
                    exc = HTTPNotAcceptable('Requested MIME content type(s) '
                                            'not acceptable.',
                                            body=','.join(mime_strings),
                                            headers=headers)
                    raise exc
                mime_type = self.__get_default_response_mime_type()
        return mime_type
983260
def get_response_content_type(self):
        """"""
        if self._best_response_match is None:
            settings = get_settings(self.application, force_instance=True)
            acceptable = headers.parse_accept(
                self.request.headers.get(
                    'Accept',
                    settings.default_content_type
                    if settings.default_content_type else '*/*'))
            try:
                selected, _ = algorithms.select_content_type(
                    acceptable, settings.available_content_types)
                self._best_response_match = '/'.join(
                    [selected.content_type, selected.content_subtype])
                if selected.content_suffix is not None:
                    self._best_response_match = '+'.join(
                        [self._best_response_match, selected.content_suffix])
            except errors.NoMatch:
                self._best_response_match = settings.default_content_type

        return self._best_response_match
75925
def content_type(self):
        """"""

        if hasattr(self, '_content_type'):
            return self._content_type

        filename, extension = os.path.splitext(self._file_path)
        if extension == '.csv':
            self._content_type = 'text/csv'
        elif extension == '.tsv':
            self._content_type = 'text/tab-separated-values'
        else:
            self._content_type = 'text/plain'

        return self._content_type
912842
def data(self):
        
        if self._data is None:
            self._data = self.response.content.decode("utf-8")
        return self._data
930103
def getresponse(self):
        
        resp = self.http.getresponse()
        self.log.info("resp is %s", str(resp))
        if resp.status < 400:
            return resp
        else:
            errtext = resp.read()
            content_type = resp.getheader('Content-Type', 'text/plain')
            raise HttpError(code=resp.status, content_type=content_type, content=errtext)
336286
public String getContentType() {
        if (contentType == null)
            contentType = getHeaderField("content-type");
        if (contentType == null) {
            String ct = null;
            try {
                ct = guessContentTypeFromStream(getInputStream());
            } catch(java.io.IOException e) {
            }
            String ce = properties.findValue("content-encoding");
            if (ct == null) {
                ct = properties.findValue("content-type");

                if (ct == null)
                    if (url.getFile().endsWith("/"))
                        ct = "text/html";
                    else
                        ct = guessContentTypeFromName(url.getFile());
            }

            /*
             * If the Mime header had a Content-encoding field and its value
             * was not one of the values that essentially indicate no
             * encoding, we force the content type to be unknown. This will
             * cause a save dialog to be presented to the user.  It is not
             * ideal but is better than what we were previously doing, namely
             * bringing up an image tool for compressed tar files.
             */

            if (ct == null || ce != null &&
                    !(ce.equalsIgnoreCase("7bit")
                      || ce.equalsIgnoreCase("8bit")
                      || ce.equalsIgnoreCase("binary")))
                ct = "content/unknown";
            setContentType(ct);
        }
        return contentType;
    }
477900
function validateResponseType (type) {
  if (validTypes.indexOf(type) < 0)
    return option.some(`Response content type ${type} is not supported`)
  return option.none
}
1318150
def _ensure_content_type():
    
    from django.contrib.contenttypes.models import ContentType
    try:
        row = ContentType.objects.get(app_label=PERM_APP_NAME)
    except ContentType.DoesNotExist:
        row = ContentType(name=PERM_APP_NAME, app_label=PERM_APP_NAME, model=PERM_APP_NAME)
        row.save()
    return row.id
732115
def content_type(self) -> ContentType:
        """"""
        return self._ctype if self._ctype else self.parent.content_type()