mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

livecheck currently doesn't support `POST` requests but it wasn't entirely clear how best to handle that. I initially approached it as a `Post` strategy but unfortunately that would have required us to handle response body parsing (e.g., JSON, XML, etc.) in some fashion. We could borrow some of the logic from related strategies but we would still be stuck having to update `Post` whenever we add a strategy for a new format. Instead, this implements `POST` support by borrowing ideas from the `using: :post` and `data` `url` options found in formulae. This uses a `post_form` option to handle form data and `post_json` to handle JSON data, encoding the hash argument for each into the appropriate format. The presence of either option means that curl will use a `POST` request. With this approach, we can make a `POST` request using any strategy that calls `Strategy::page_headers` or `::page_content` (directly or indirectly) and everything else works the same as usual. The only change needed in related strategies was to pass the options through to the `Strategy` methods. For example, if we need to parse a JSON response from a `POST` request, we add a `post_data` or `post_json` hash to the `livecheck` block `url` and use `strategy :json` with a `strategy` block. This leans on existing patterns that we're already familiar with and shouldn't require any notable maintenance burden when adding new strategies, so it seems like a better approach than a `Post` strategy.
last_review_date
last_review_date |
---|
1970-01-01 |
Homebrew Docs
These are the source files for the Homebrew documentation site.
A GitHub Action is run to validate each change before the site is deployed to GitHub Pages.
Usage
Open https://docs.brew.sh in your web browser.
To instead generate the site locally, available on localhost:4000, run:
cd `brew --repository`/docs
bundle install
bundle exec jekyll serve --watch