Nugine / s3s

S3 Service Adapter
Apache License 2.0
132 stars 33 forks source link

Setting Location header in S3Error with s3s::S3ErrorCode::TemporaryRedirect #133

Closed jrandall closed 6 months ago

jrandall commented 6 months ago

It is possible in an s3s service to trigger a 307 redirect response from within an S3 trait method by returning Err(s3_error!(TemporaryRedirect)) but I cannot find a way to set the Location header in the response, and without this the redirect is not particularly useful. Is there currently any way to add the location header at present?

If not, rather than implement something specific to redirects, perhaps it would be easiest to simply add a header map to the S3Error type that can be handled much the same as in S3Response?

Nugine commented 6 months ago

Added in 6d8a5c3

https://github.com/Nugine/s3s/blob/6d8a5c3f925bb89114cfab4ffeec19f181965c37/crates/s3s/src/ops/tests.rs#L37-L64