Any Material On Rack, Middleware and Servers?

Hello, does Upcase have any material on Rack or Middleware? There’s a ton of exciting material here, but I was wondering if you guys cover important lower level details of the rails engine like Rack and the servers that communicate with Rack. Also, what about testing these lower level technologies?

Side note: I do not know why I’m only allowed to select HTTP as the category of this post, but I think Upcase would be a better category type.

1 Like

Hi there! I’m glad you wrote in about this because I was just thinking about writing a blog post about writing my first piece of rack middleware.

While the blog post has not been written yet, I can link you to an open source commit that I made as a result of this first middleware venture: Add optional middleware for removing `Set-Cookie` · fastly/fastly-rails@d4f1d08 · GitHub

This includes both the middleware and a test for the middleware. I personally found testing to be the hardest part of creating my first rack middleware.

I will work on that blog post soon and link you to it when it’s done! :smile:

2 Likes

Thank you for sharing your commit. I agree with you. Testing is the hard part. Your implementations looks great and so do your tests. Here’s a sample of my tests for a piece of middleware. I would suggest creating a mock object for the app object, the other piece of rack middleware, in your tests and just evaluate, #call, in your middleware.