{"id":20595510,"url":"https://github.com/thefrontside/rack-current","last_synced_at":"2025-04-14T23:43:54.671Z","repository":{"id":3800951,"uuid":"4879906","full_name":"thefrontside/rack-current","owner":"thefrontside","description":"Rack middleware to make current request available to all","archived":false,"fork":false,"pushed_at":"2016-01-07T02:33:49.000Z","size":10,"stargazers_count":2,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T11:51:05.741Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thefrontside.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-04T02:47:41.000Z","updated_at":"2015-09-28T07:12:07.000Z","dependencies_parsed_at":"2022-09-13T17:51:48.257Z","dependency_job_id":null,"html_url":"https://github.com/thefrontside/rack-current","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefrontside%2Frack-current","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefrontside%2Frack-current/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefrontside%2Frack-current/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefrontside%2Frack-current/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thefrontside","download_url":"https://codeload.github.com/thefrontside/rack-current/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248537003,"owners_count":21120687,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T08:13:20.465Z","updated_at":"2025-04-14T23:43:54.653Z","avatar_url":"https://github.com/thefrontside.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rack::Current\n\nSometimes, in the course of human events, you need to access the currently executing http request, and you\ndon't always have the luxury of passing it around, especially when you're working with frameworks that manage\nthe lifecycle of objects for you, or you want to include functionality from a module. That module might not have\na clean way of getting a reference to the request object.\n\n### Rack::Current can help\n\nCurrentRequest stores the current request in a thread local so that you can access it from anywhere inside the\nrequest stack.\n\n### Oooh. Thread locals, I hear those are dangerous.\n\nNot really. There are certain objects whose natural scope is the lifetime of an http request. The http request object\nitself is one such object. As long as the thread is the fundamental unit of concurrency in your server, you'll be ok.\n\nThat said, you should ensure that you are in fact including this into methods that will be invoked inside the request\nstack, and not, say, like a background job (like sending email) that is fired off during the course of a request.\n\n### Example\n\n        class Foo\n          include Rack::Curent\n\n          def current_url\n            \"#{current_request.protocol}://#{current_request.host}/#{current_request.path}\n          end\n        end\n\n## Code of Conduct\nPlease note that this project is released with a Contributor Code of\nConduct. By participating in this project you agree to abide by its\nterms, which can be found in the `CODE_OF_CONDUCT.md` file in this\nrepository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthefrontside%2Frack-current","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthefrontside%2Frack-current","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthefrontside%2Frack-current/lists"}