logstash-plugins / logstash-filter-http

HTTP Filter Plugin for Logstash
Apache License 2.0
12 stars 29 forks source link

Resolve the content type from the list/array of content-types. #46

Closed mashhurs closed 1 year ago

mashhurs commented 1 year ago

Release notes

[rn:skip]

What does this PR do?

Fixes the crash when plugin receives the Content-Type header as an Array. This change introduces a resolution of content type which supports: array, string and empty string.

Why is it important/What is the impact to the user?

Some applications (example apigateway-openlogging-elk) is using a server which responses list of Content-Type media types.

Checklist

Author's Checklist

How to test this PR locally

http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': ['text/plain', 'logstash/custom-type']} ); response.end('Hello World\n'); }).listen(8081);

console.log('Server running at http://127.0.0.1:8081/');



## Related issues
- Closes #45 

## Use cases

<!-- Recommended
Explain here the different behaviors that this PR introduces or modifies in this project, user roles, environment configuration, etc.

If you are familiar with Gherkin test scenarios, we recommend its usage: https://cucumber.io/docs/gherkin/reference/
-->

## Screenshots

<!-- Optional
Add here screenshots about how the project will be changed after the PR is applied. They could be related to web pages, terminal, etc, or any other image you consider important to be shared with the team.
-->

## Logs

<!-- Recommended
Paste here output logs discovered while creating this PR, such as stack traces or integration logs, or any other output you consider important to be shared with the team.
-->