Is there a standard 'null' mime-type

前端 未结 3 1416
名媛妹妹
名媛妹妹 2021-01-19 07:13

I am using a single JSON response format to cover a number of possible responses.

The response contains a field that, optionally, contains a link to an external reso

相关标签:
3条回答
  • 2021-01-19 07:14

    I agree with DanielTate's comment on the original question: I don't think there is a "null media type" (media type a.k.a. MIME type). I haven't looked through the entire IANA registry, but I very much doubt there's anything there. The media type RFC doesn't appear to mention anything like this -- I haven't read the whole thing, but did scan the TOC and search around for "null" "empty" "invalid".

    What's clear is: media type is supposed to be metadata about something. Given your question, I'm trying to guess why you might be thinking about a null media type (if you added some specific json examples in your question, it might be clearer), but, generally speaking, it just doesn't make much sense: in theory, you shouldn't need to describe nothing (i.e., a non-existing resource) with any kind of media type: there's already nothing there, so why describe it further as having a "null media type"?

    If I understand your situation correctly, when there is no resource, I would just use an empty string. Maybe that's the null media type :) But, for some reason, you seem to really want to specify a media type in your response, even when there's no resource (or no link). Why is that?

    0 讨论(0)
  • 2021-01-19 07:22

    jus add a comma at the end

    if( checkType( $_FILES["CV"]["type"], "application/pdf,image/jpeg,image/png,video/mp4,audio/mpeg,application/msword,application/excel,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.wordprocessingml.document," ) ) {
    
    0 讨论(0)
  • 2021-01-19 07:26

    The IANA reserves "example" for, well, example purposes. But since "example" shall never be used as a real mime type, example/example could serve as an (internally used) compatible "null" MIME type.

    https://www.iana.org/assignments/media-types/media-types.xhtml#examples

    example

    Note: The 'example' media type is used for examples. Any subtype following the media type syntax may be used in those examples. No subtype can be registered with IANA. For more information see[RFC4735].

    Note: The occurrence of an 'example' media type as a media type outside of examples, e.g. in a Content-Type header, is an error and should be reported to the implementor.[RFC2045][RFC2046] specifies that Content Types, Content Subtypes, Character Sets, Access Types, and conversion values for MIME mail will be assigned and listed by the IANA.

    0 讨论(0)
提交回复
热议问题