I have an RSS feed that I'm putting in the Cloud. Unfortunately, the Cloud is a disaster and can't even get the MIME-type right by default.

It gives me (note I’ve since manually changed the MIME-type so this is different):

URLRead["https://www.wolframcloud.com/objects/b3m2a1/tutorial/index/rss_feed.xml", "Headers"]~Lookup~"content-type"


Here's what it should have given me:

URLRead["https://paclets.github.io/PacletServer/index/rss_feed.xml", "Headers"]~Lookup~"content-type"


Now, in my CopyFile call I can specify the "MIMType" explicitly (per this kludge). I can even do this semi-automatically via:

CopyFile[file, dest, 
   ToUpperCase@StringTrim[FileExtension[file], "."]

It'd be much nicer though if in the intervening two years something had come up to allow me to tell Mathematica what MIME-type to use for which extensions without my having to supply this manually.

Is there such a thing?

  • 1
    $\begingroup$ Quick thought, have you tried deploying HTTPResponse with manually crafted headers/content? (sorry if I missed the point and that is not suitable) $\endgroup$ – Kuba Jul 19 '18 at 11:00
  • 1
    $\begingroup$ @Kuba I can't say I entirely know what you're trying to get at, although I think I do. My use case for this is as the RSS feed for a static website, so it'd be best to be able to serve the resources statically (and I have a workaround for my specific case). On the other hand, if I weren't just copying files that would be an entirely reasonable approach. Certainly would allow for more fine-grained control over what happens. $\endgroup$ – b3m2a1 Jul 19 '18 at 11:04
  • $\begingroup$ What version are you using? I get this in 11.3: In[12]:= URLRead[ "https://www.wolframcloud.com/objects/b3m2a1/tutorial/index/rss_\ feed.xml", "Headers"]~Lookup~"content-type" Out[12]= "APPLICATION/XML" $\endgroup$ – GenericAccountName Jul 19 '18 at 16:56
  • $\begingroup$ @GenericAccountName that’s because I’ve since patched the MIME-type to be correct $\endgroup$ – b3m2a1 Jul 19 '18 at 18:02

Your Answer

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

Browse other questions tagged or ask your own question.