Title: Inconsistency in middleware docs · Issue #13 · roach-php/roach-php.dev · GitHub
Open Graph Title: Inconsistency in middleware docs · Issue #13 · roach-php/roach-php.dev
X Title: Inconsistency in middleware docs · Issue #13 · roach-php/roach-php.dev
Description: A separate issue could be opened for roach-php/core, wherein code refactoring is suggested. The documentation at https://roach-php.dev/docs/downloader-middleware states: Downloader middleware that process outgoing requests before they ge...
Open Graph Description: A separate issue could be opened for roach-php/core, wherein code refactoring is suggested. The documentation at https://roach-php.dev/docs/downloader-middleware states: Downloader middleware that ...
X Description: A separate issue could be opened for roach-php/core, wherein code refactoring is suggested. The documentation at https://roach-php.dev/docs/downloader-middleware states: Downloader middleware that ...
Opengraph URL: https://github.com/roach-php/roach-php.dev/issues/13
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistency in middleware docs","articleBody":"_A separate issue could be opened for [roach-php/core](https://github.com/roach-php/core), wherein code refactoring is suggested._\r\n\r\nThe documentation at https://roach-php.dev/docs/downloader-middleware states:\r\n\r\n\u003e Downloader middleware that process outgoing requests before they get sent need to implement `RequestMiddlewareInterface`.\r\n\r\nThen example code is provided,\r\n```php\r\nuse RoachPHP\\Downloader\\Middleware\\RequestMiddlewareInterface;\r\nuse RoachPHP\\Http\\Request;\r\nuse RoachPHP\\Support\\Configurable;\r\n\r\nclass MyRequestMiddleware implements RequestMiddlewareInterface\r\n{\r\n // ...\r\n}\r\n```\r\nNote the namespace of `RequestMiddlewareInterface`.\r\n\r\nFurther down, the documentation states:\r\n\r\n\u003e Downloader middleware that deal with responses need to implement `ResponseMiddlewareInterface`.\r\n\r\nThen example code is provided,\r\n```php\r\nuse RoachPHP\\Http\\Response;\r\nuse RoachPHP\\Spider\\Middleware\\ResponseMiddlewareInterface;\r\nuse RoachPHP\\Support\\Configurable;\r\n\r\nclass MyResponseMiddleware implements ResponseMiddlewareInterface\r\n{\r\n // ...\r\n}\r\n```\r\nNote again the namespace, this time of `ResponseMiddlewareInterface`.\r\n\r\nApparently there is:\r\n```php\r\nuse RoachPHP\\Downloader\\Middleware\\RequestMiddlewareInterface;\r\nuse RoachPHP\\Spider\\Middleware\\RequestMiddlewareInterface;\r\n\r\nuse RoachPHP\\Downloader\\Middleware\\ResponseMiddlewareInterface;\r\nuse RoachPHP\\Spider\\Middleware\\ResponseMiddlewareInterface;\r\n```\r\n\r\nAlthough there is the disclaimer that\r\n\u003e Note that downloader request middleware gets run after [spider request middleware](https://roach-php.dev/docs/spider-middleware#request-middleware). The exception to this are the [initial requests](https://roach-php.dev/docs/spiders#generating-the-initial-requests), which don’t get sent through the spider middleware at all.\r\n\r\nand that\r\n\u003e Downloader response middleware gets run immediately after a response was received. This means it gets run before any [spider response middleware](https://roach-php.dev/docs/spider-middleware#response-middleware).\r\n\r\n(which I only saw upon writing this issue), I suggest making this less confusing. Perhaps a code refactoring should be done: why two interface namespaces if they could be simplified to one?\r\n\r\nHow I stumbled upon this, is my IDE suggesting that both namespaces could be used.","author":{"url":"https://github.com/pedzed","@type":"Person","name":"pedzed"},"datePublished":"2023-05-25T07:04:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/13/roach-php.dev/issues/13"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f7e2add7-18d8-1b19-c27a-78042586a49a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B158:1F80F:2A9BB70:3679E96:6991C78A |
| html-safe-nonce | dc36f9c68ebf740c53b22565909ee04517dad7152b2ad8bb9717ad65171633f3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTU4OjFGODBGOjJBOUJCNzA6MzY3OUU5Njo2OTkxQzc4QSIsInZpc2l0b3JfaWQiOiIzNjM4Mjk0MzQ2MTMyOTk4MDI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8e5ac7efc2b7adf1a3f21ef15c00f3a997e53007b7ff4bb8e9fad03371945c82 |
| hovercard-subject-tag | issue:1725217032 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/roach-php/roach-php.dev/13/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8f2ea81fbbb7c7af4e89dcffa331a0ea20151c9f20a87086d2587a8ab37ce63d/roach-php/roach-php.dev/issues/13 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8f2ea81fbbb7c7af4e89dcffa331a0ea20151c9f20a87086d2587a8ab37ce63d/roach-php/roach-php.dev/issues/13 |
| og:image:alt | A separate issue could be opened for roach-php/core, wherein code refactoring is suggested. The documentation at https://roach-php.dev/docs/downloader-middleware states: Downloader middleware that ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pedzed |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/roach-php/roach-php.dev git https://github.com/roach-php/roach-php.dev.git |
| octolytics-dimension-user_id | 88873474 |
| octolytics-dimension-user_login | roach-php |
| octolytics-dimension-repository_id | 397134365 |
| octolytics-dimension-repository_nwo | roach-php/roach-php.dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 397134365 |
| octolytics-dimension-repository_network_root_nwo | roach-php/roach-php.dev |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width