Sovrascrivere un tipo MIME in Rails
-
01-07-2019 - |
Domanda
Voglio sovrascrivere il tipo MIME JSON ("application/json") in Rails in ("text/x-json").Ho provato a registrare nuovamente il tipo MIME in mime_types.rb ma non ha funzionato.Eventuali suggerimenti?
Grazie.
Soluzione
Questo dovrebbe funzionare (in un inizializzatore, plugin o qualche posto simile):
Mime.send(:remove_const, :JSON)
Mime::Type.register "text/x-json", :json
Altri suggerimenti
Tentativo:
render :json => var_containing_my_json, :content_type => 'text/x-json'
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow