SyliusResourceBundle
SyliusResourceBundle copied to clipboard
Not possible to set your own response by an event for non-HTML requests
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Sylius version | 1.0.0 |
ResouceController:
if ($event->isStopped() && !$configuration->isHtmlRequest()) {
throw new HttpException($event->getErrorCode(), $event->getMessage());
}
if ($event->isStopped()) {
$this->flashHelper->addFlashFromEvent($configuration, $event);
if ($event->hasResponse()) {
return $event->getResponse();
}
return $this->redirectHandler->redirectToResource($configuration, $resource);
}
It should be possible to set your own response for non-HTML requests.
Yeah, this is pretty reasonable. However, there are a lot of whitespace changes. I just added cljfmt
to the project, can you merge with my changes, and run lein cljfmt
on yours? Thanks.
Is there anything else you would like me to do for this PR?
Also, I'm using https://github.com/hozumi/clj-det-enc locally to detect the character encoding, would you mind if I added that here? The issue being it's another dependency for the project...
I'd prefer it be an optional dependency like the others, if possible.
Actually, looking at that code, I'm not sure how it works with HTTP requests, since it'll consume the head of the InputStream. Can you expand on how that would be used here?
I've added the code to the PR. It does mean you have to specify if you want an InputStream, rather than being the default.
I'd honestly prefer it be left out. If it belongs anywhere, it belongs in byte-streams
. Let me give it some thought.
Indeed it would be nice in bs/to-string
, I want that function to do as much for me as possible. Would it adversely affect performance though? If so it could be an option :detect true
... Also, I think I will change the default coercion to be none at all and require :as :string
if you want a String. What do you think?
Yes, I'd prefer no coercion to be the default. On Mar 4, 2015 12:25 AM, "David Smith" [email protected] wrote:
Indeed it would be nice in bs/to-string, I want that function to do as much for me as possible. Would it adversely affect performance though? If so it could be an option :detect true... Also, I think I will change the default coercion to be none at all and require :as :string if you want a String. What do you think?
— Reply to this email directly or view it on GitHub https://github.com/ztellman/aleph/pull/154#issuecomment-77115452.