Exception: OpenReceive::Server::UnsupportedMediaTypeError
- Inherits:
-
StandardError
- Object
- StandardError
- OpenReceive::Server::UnsupportedMediaTypeError
- Defined in:
- lib/openreceive/server/errors.rb
Overview
415 — the body-bearing routes accept application/json only. This is the
CSRF-equivalent on cookie-authenticated mounts: a cross-site HTML form
cannot set a JSON content type, and a cross-origin fetch that does is
non-simple (CORS-preflighted, which the library never grants), so a
forgery can never reach authorize with the victim's session. Rejected
before authorize, like the body cap. Mirrors the JS handler.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(message = "Request content type must be application/json.") ⇒ UnsupportedMediaTypeError
constructor
A new instance of UnsupportedMediaTypeError.
Constructor Details
#initialize(message = "Request content type must be application/json.") ⇒ UnsupportedMediaTypeError
Returns a new instance of UnsupportedMediaTypeError.
130 131 132 133 134 |
# File 'lib/openreceive/server/errors.rb', line 130 def initialize( = "Request content type must be application/json.") super() @status = 415 @code = "INVALID_REQUEST" end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
128 129 130 |
# File 'lib/openreceive/server/errors.rb', line 128 def code @code end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
128 129 130 |
# File 'lib/openreceive/server/errors.rb', line 128 def status @status end |