Elixir download file binary put_resp_header






















The Overflow Blog. Who owns this outage? Building intelligent escalation chains for modern SRE. Podcast Who is building clouds for the independent developer? Featured on Meta. Now live: A fully responsive profile. Reducing the weight of our footer. Related Hot Network Questions. Question feed. The request information in these fields is not populated until it is fetched. If you access these fields before fetching them, they will be returned as.

Response fields. These fields contain response information:. It is set. The response. Note, response headers. Connection fields. This data must be kept in the connection and never used directly, always. The connection state is used to track the connection lifecycle.

It starts as. Private fields. Custom status codes. Plug allows status codes to be overridden or added in order to allow new codes. Adding or overriding a status. As this configuration is Plug specific, Plug will need to be recompiled for. To recompile. The atoms that can be used in place of the status code in many functions are.

With the above. Error raised when no response is sent in a request. Error raised when trying to modify or send an already sent response. Error raised when the cookie exceeds the maximum size of bytes. Error raised when trying to send a header that has errors, for example:. Raised when the request string is malformed, for example:. Assigns a value to a key in the connection.

The "assigns" storage is meant to be used to store values in the connection. The assigns storage. Assigns multiple values to keys in the connection. This storage is meant to be used by libraries and frameworks to avoid writing. It is recommended for. Stores the given status code in the connection. The list of allowed. Sends a response to the client. Note that this function does not halt the connection, so if.

If available, the file is sent directly over the socket using. Sends the response headers as a chunked response.

To recompile Plug:. The atoms that can be used in place of the status code in many functions are inflected from the reason phrase of the status code. With the above configuration, the following will all work:. Returns session value for the given key. If key is not set, nil is returned. Halts the Plug pipeline by preventing further plugs downstream from being invoked. See the docs for Plug. Builder for more information on halting a Plug pipeline. Adds a new request header key if not present, otherwise replaces the previous value of that header with value.

Sets the value of the "content-type" response header taking into account the charset. Adds a new response header key if not present, otherwise replaces the previous value of that header with value. Puts the specified value in the session for the given key. Sets the response to the given status and body. Sends a file as the response body with the given status and optionally starting at the given offset until the given length. The "assigns" storage is meant to be used to store values in the connection so that other plugs in your plug pipeline can access them.

The assigns storage is a map. To stream data use Enum. Raises a Plug. AlreadySentError if the connection has already been :sent or :chunked. Deleting a cookie requires the same options as to when the cookie was put. This function does not fetch parameters from the body. To fetch parameters from the body, use the Plug.

Parsers plug. Keep in mind the webserver you are using may have a more strict limit. For example, for the Cowboy webserver, please read.

Defaults to true. So this function always returns a map with string keys. An informational response, such as an early hint, must happen prior to a response being sent. If an informational request is attempted after a response is sent then a Plug. AlreadySentError will be raised. Only status codes from are valid. It is recommended for header keys to be in lowercase, to avoid sending duplicate keys in a request.

Active Oldest Votes. In a Phoenix controller call the function with the uploaded file's path. Community Bot 1 1 1 silver badge. Jagdish Jagdish 8 8 silver badges 20 20 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password.

Post as a guest Name. Email Required, but never shown.



0コメント

  • 1000 / 1000