Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a standard 'null' mime-type

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 resource.

The response is valid, regardless of whether this field is populated.

I am using a separate mime-type field to dictate how the client should handle said field.

i.e.

mime-type : video/mp4

Client plays the video

mime-type : text/html

Client launches a browser with the given URL

What I would like to know, is if there is a "standard" mime-type to cover an empty resource.
I know I can use a vendor specific mime-type, and most likely will, but it made me question.

Thanks.

like image 261
abovethewater Avatar asked Oct 02 '22 08:10

abovethewater


1 Answers

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?

like image 73
Hawkeye Parker Avatar answered Oct 13 '22 10:10

Hawkeye Parker