Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up to #2623012: Implement interfaces and base classes for URL-based sources
getRequestHeaders() and setRequestHeaders() are currently part of the DataFetchPluginInterface, but are really only applicable to an HTTP fetcher. Let's get them out of the general interface. I see adding a "fetcher_options" configuration key for the fetcher plugin, where headers could be specified.
Comment | File | Size | Author |
---|---|---|---|
#4 | make_custom_headers_an-2640512-3.patch | 5.24 KB | mikeryan |
Comments
Comment #2
mikeryanComment #3
mikeryanSo, DataFetcherPluginInterface currently has setRequestHeaders(), getRequestHeaders(), getResponseContent(), and getResponse() APIs. Only getResponseContent() is relevant in general for fetchers, and the name sort of assumes HTTP - it should be renamed getContent() (I'll leave a BC stub implementation for it).
Comment #4
mikeryanComment #5
Grayside CreditAttribution: Grayside at Phase2 for Norwegian Cruise Line commentedIn my work on #2640516: Support paging through multiple requests I've been thinking of HTTP headers as "metadata", with the idea that other fetch methods could implement other sorts of metadata extraction mechanisms than reading headers. (e.g., id3 tags on music files). Overall makes sense to pull it from the interface, but something along the metadata notion might be valuable when more parser plugins use the data fetchers.
Comment #6
mikeryanThe headers in this case are the *request* headers, being sent out. Extracting response headers (or other metadata) would be a subject for another issue entirely...
But, that does remind me of the "fetcher_options" thought I had in the issue summary, I should apply that here...