Skip to content
Snippets Groups Projects

Issue #3352503: Allow HTTP fetcher to make POST calls

@@ -61,6 +61,9 @@ class Http extends DataFetcherPluginBase implements ContainerFactoryPluginInterf
// Ensure there is a 'headers' key in the configuration.
$configuration += ['headers' => []];
$this->setRequestHeaders($configuration['headers']);
// Set GET request-method by default.
$configuration += ['method' => 'GET'];
$this->configuration['method'] = $configuration['method'];
}
/**
@@ -101,7 +104,8 @@ class Http extends DataFetcherPluginBase implements ContainerFactoryPluginInterf
if (!empty($this->configuration['request_options'])) {
$options = NestedArray::mergeDeep($options, $this->configuration['request_options']);
}
$response = $this->httpClient->get($url, $options);
$method = $this->configuration['method'] ?? 'GET';
$response = $this->httpClient->request($method, $url, $options);
if (empty($response)) {
throw new MigrateException('No response at ' . $url . '.');
}
Loading