NancyFX has Content Negotiation feature that I can write additional serialization adapter for S-expression by implementing IResponseProcessor interface.

And there is a problem... S-expression's MIME type seems to be text/plain. So the web server cannot decide actual text file type in HTTP_ACCEPT header.

Is there well known practice for deciding MIME type of text file? For example,

  • text/plain+s: adding its file extension
  • text/plain+s-expression: adding language name

Media Types (note, they are not called MIME types anymore, the official name is Media Type and Media Subtype) are assigned by IANA. If you want to add a media type, you need to fill out the application and wait for it to be approved.

Both of your suggestions are illegal, because they are not registered Media Types.

The syntax of a Media Type is:

<media-type>"/"[<tree>"."]<media-subtype>["+"<suffix>]["; "<parameter>]*

Media Type

The <media-type> MUST be one of the following:

  • application
  • audio
  • font
  • example
  • image
  • message
  • model
  • multipart
  • text
  • video

In your case, since we are actually talking about executable code, the correct Type would be application.


There are four trees defined:

  • The standard tree (no prefix)
  • The vendor-specific tree (vnd)
  • The personal (or "vanity") tree (prs)
  • The experimental tree (x), which roughly corresponds to the older, now obsolete, x- prefix

The standard tree is for representations defined in IETF standards or in standards of IETF-recognized standards bodies (e.g. ISO). AFAICS, NancyFX's format is not published in any such standard, so this tree is not appropriate.

The personal tree is for applications that are not published. This does not apply either.

The experimental tree is for experimental applications where the sender and receiver have a strong private agreement about the meaning of the Media Type. This is the only tree that does not require registration (in fact, you cannot register a Media Type in the experimental tree). Use of the experimental tree is strongly discouraged.

The vendor tree is for representations that are defined by published applications by some sort of vendor (or producer, as the standard also calls them). This would be the one that is applicable to NancyFX. So, the tree would be vnd.

Media Subtype

The Media Subtype can be more or less freely chosen, but there of course restrictions about the length, allowed characters, and strong naming guidelines.


The Structured Syntax Suffix is used to indicate that the representation is actually an application of an underlying structured syntax that is shared by multiple representations. These suffixes also need to be registered. The currently registered suffixes are:

  • xml
  • json
  • ber
  • cbor
  • der
  • fastinfoset
  • wbxml
  • zip
  • tlv
  • json-seq
  • sqlite3
  • jwt
  • gzip

The format you describe is an application of a structured syntax (S-Expressions), so it should have structured syntax suffix. However, there is no suffix for S-Expressions currently defined.

The suffix should be something like s-expression

Putting it all together

Putting it all together, the correct Media Type for the representation you describe is:


But you are not allowed to use this until you have successfully registered the s-expression structured syntax suffix, and the nancy-fx media subtype in the vendor tree.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.