Rack Middleware for Input Sanitization
Building a Rack Middleware - Shopify

Building a Rack Middleware - Shopify

9/4/2013

What this post added

This post details the creation of a custom Rack middleware to sanitize user input for shop URLs before it's processed by OmniAuth. It explains the problem of invalid URI generation due to user input errors, the decision to implement a middleware for pre-processing, and the design of the middleware. The implementation includes a strategy pattern for sanitization, with an example of a whitespace cleaning strategy that recovers shop names based on common conventions. The post also provides a basic Rack response structure and the middleware implementation itself, highlighting how arguments are passed during initialization.

Read the original post ↗