carrierwave-meta icon indicating copy to clipboard operation
carrierwave-meta copied to clipboard

Should Use "Type" By Default

Open yfeldblum opened this issue 11 years ago • 1 comments

The field name should be e.g. image_type or image_mime_type, referring to the image's MIME type, rather than image_content_type, since only MIME-like messages have content types.

"Content-Type" comes from the HTTP response (and multipart request header) header of that name. There are many headers prefixed with Content- though, including Content-Length and Content-Encoding, and their purpose is to describe the content of the HTTP response. As an example of their meaning: the Content in this response has a Type of application/html, a Length of 12943 in bytes, and an Encoding of gzip.

The following are standard headers in HTTP request messages, HTTP response messages, or multipart/form-data messages:

  • Content-Disposition
  • Content-Encoding
  • Content-Language
  • Content-Length
  • Content-Location
  • Content-MD5
  • Content-Range
  • Content-Transfer-Encoding
  • Content-Type

They describe the Content part of the message, just like the field image_type should describe the image part of the model object.

yfeldblum avatar Jul 25 '12 21:07 yfeldblum

I could agree with this but existing projects are already using content_type name unfortunately. I'll add alias attribute _type.

gzigzigzeo avatar Aug 03 '13 09:08 gzigzigzeo