Skip to content

[Synthetics] http monitors - account for custom Content-Type headers - #159737

Merged
shahzad31 merged 2 commits into
elastic:mainfrom
dominiqueclarke:fix/synthetics-content-type-headers
Jun 19, 2023
Merged

shahzad31 merged 2 commits into
elastic:mainfrom
dominiqueclarke:fix/synthetics-content-type-headers

Conversation

@dominiqueclarke

@dominiqueclarke dominiqueclarke commented Jun 14, 2023 •

Copy link
Copy Markdown
Contributor

Release note

Ensures that users can configure custom Content-Type headers for HTTP monitors in the Synthetics app.

Summary

This PR fixes two bugs identified by an SDH.

  1. We are supposed to automatically add default Content-Type headers to the monitor payload based on the MIME type of the request body. We were doing so in Uptime, but have not been in the Synthetics app. This PR ensures the default Content-Type header is applied for UI monitors
  2. When users attempted to use custom Content-Type headers, they were being removed on subsequent monitor edits. This PR ensures that they are preserved

Testing

  1. Create a basic HTTP monitor. Inspect the monitors configuration. Ensure that check.request.headers value is set to Content-Type: 'text/plain.
  2. Create another basic HTTP monitor, but instead set the request body to JSON. Ensure the check.request.headers value is set to Content-Type: 'application/json'
  3. Create another HTTP monitor, this time add a custom Content-Type in the request headers section. For example, you can just use Content-Type: custom. Make sure you set the request headers, not the response headers or proxy headers.
  4. Inspect that monitor's configuration. Ensure the Content-Type: custom header is present in check.request.headers.
  5. Attempt to edit that HTTP monitor, ensure that the custom Content-Type header remains in the UI edit flow. Save the monitor.
  6. Inspect that monitor's configuration. Ensure the Content-Type: custom header still remains in check.request.headers.

@ghost

ghost commented Jun 14, 2023

Copy link
Copy Markdown

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@kibana-ci

Copy link
Copy Markdown

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
synthetics 1.2MB 1.2MB +158.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 13 15 +2
securitySolution 410 414 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 14 16 +2
securitySolution 493 497 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@dominiqueclarke dominiqueclarke changed the title synthetics - http monitors - account for custom Content-Type headers [Synthetics] http monitors - account for custom Content-Type headers Jun 15, 2023
@dominiqueclarke dominiqueclarke added release_note:fix bug Fixes for quality problems that affect the customer experience Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.8.2 labels Jun 15, 2023
@dominiqueclarke
dominiqueclarke marked this pull request as ready for review June 15, 2023 14:54
@dominiqueclarke
dominiqueclarke requested a review from a team as a code owner June 15, 2023 14:54
@elasticmachine

Copy link
Copy Markdown
Contributor

Pinging @elastic/uptime (Team:uptime)

@shahzad31 shahzad31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !!

@shahzad31
shahzad31 merged commit fc32999 into elastic:main Jun 19, 2023
@shahzad31
shahzad31 deleted the fix/synthetics-content-type-headers branch June 19, 2023 11:50
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 19, 2023
@kibanamachine

Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
✅ 8.8

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jun 19, 2023
…aders (#159737) (#159918)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Synthetics] http monitors - account for custom Content-Type headers
(#159737)](#159737)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Dominique
Clarke","email":"dominique.clarke@elastic.co"},"sourceCommit":{"committedDate":"2023-06-19T11:49:55Z","message":"[Synthetics]
http monitors - account for custom Content-Type headers
(#159737)","sha":"fc32999c91760ed399b872d507fd84d308f5829e","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:uptime","v8.9.0","v8.8.2"],"number":159737,"url":"https://github.com/elastic/kibana/pull/159737","mergeCommit":{"message":"[Synthetics]
http monitors - account for custom Content-Type headers
(#159737)","sha":"fc32999c91760ed399b872d507fd84d308f5829e"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/159737","number":159737,"mergeCommit":{"message":"[Synthetics]
http monitors - account for custom Content-Type headers
(#159737)","sha":"fc32999c91760ed399b872d507fd84d308f5829e"}},{"branch":"8.8","label":"v8.8.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
@justinkambic justinkambic self-assigned this Jun 29, 2023
@justinkambic

Copy link
Copy Markdown
Contributor

Post-FF Testing LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes for quality problems that affect the customer experience release_note:fix Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.8.2 v8.9.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants