Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions content/v2.0/actions/formats-and-mime-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,16 @@ If you need your actions to work with additional MIME types, you can configure t

module Bookshelf
class App < Hanami::App
# config.actions.formats.add :html
config.actions.formats.add :custom, "application/custom"
end
end
```

This will add the `:custom` format for the `"application/custom"` MIME type and also configure your actions to use this format.

The **first format added will be the default format**, so you likely want to add `:html` or `:json` before any custom formats.

You can also configure a format to map to multiple MIME types:

```ruby
Expand Down
3 changes: 3 additions & 0 deletions content/v2.1/actions/formats-and-mime-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,16 @@ If you need your actions to work with additional MIME types, you can configure t

module Bookshelf
class App < Hanami::App
# config.actions.formats.add :html
config.actions.formats.add :custom, "application/custom"
end
end
```

This will add the `:custom` format for the `"application/custom"` MIME type and also configure your actions to use this format.

The **first format added will be the default format**, so you likely want to add `:html` or `:json` before any custom formats.

You can also configure a format to map to multiple MIME types:

```ruby
Expand Down
3 changes: 3 additions & 0 deletions content/v2.2/actions/formats-and-mime-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,16 @@ If you need your actions to work with additional MIME types, you can configure t

module Bookshelf
class App < Hanami::App
# config.actions.formats.add :html
config.actions.formats.add :custom, "application/custom"
end
end
```

This will add the `:custom` format for the `"application/custom"` MIME type and also configure your actions to use this format.

The **first format added will be the default format**, so you likely want to add `:html` or `:json` before any custom formats.

You can also configure a format to map to multiple MIME types:

```ruby
Expand Down