pedestal-docs icon indicating copy to clipboard operation
pedestal-docs copied to clipboard

Content for the "What is an Interceptor?" guide needs to be written

Open mtnygard opened this issue 8 years ago • 3 comments

Topics to cover:

  • [x] Basic structure of :enter, :leave, and :error functions
  • [x] Creating an interceptor from a map
  • [x] Interceptors as values (i.e., def with a map)
  • [x] Interceptors constructed in functions (closing over state)
  • [x] The IntoInterceptor protocol (use a defrecord for an example)
  • [x] Async return from an interceptor
  • [x] Streaming response bodies
  • [x] Distinction between interceptors as a general technique vs. the HTTP handling interceptors in Pedestal

mtnygard avatar Dec 20 '16 19:12 mtnygard

I've fixed a couple of typos that I'll post a PR for if you like, but I'm not sure your intent with this paragraph (first sentence or so, really).

This is where we have to start being precise about the difference between an interceptor how it gets invoked. "Interceptor" is a very general concept.

Do you intend, ...the difference between an interceptor and middleware..., or ...start being precise about how an interceptor gets invoked. I feel like this is a placeholder for more explanation.

luskwater avatar Nov 08 '17 15:11 luskwater

I’d be delighted to see a PR.

For that paragraph, the intent is to distinguish Interceptors as a general model for use in other, non-web, contexts versus the way that servlet-interceptor uses them.

It’s significant because the behavior of stopping once a response is attached is specific to the servlet-interceptor’s chain. Likewise, the notion of a handler function being treated automatically as an interceptor is very specific to web requests.

mtnygard avatar Nov 08 '17 18:11 mtnygard

Not all of this will go into "What is an Interceptor?" which is more of a beginner's introduction, but I've verified that all the bullet-items in the list are present there or in the reference pages (or both).

hlship avatar Dec 02 '22 23:12 hlship