[PR #4510] [MERGED] Set default request accept headers #10126

Closed
opened 2026-02-07 06:14:33 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/4510
Author: @crobibero
Created: 11/19/2020
Status: Merged
Merged: 11/22/2020
Merged by: @joshuaboniface

Base: masterHead: http-accept-header


📝 Commits (2)

  • c2d2c57 Set default request accept headers
  • c53b4f5 Add xml and quality

📊 Changes

1 file changed (+8 additions, -0 deletions)

View changed files

📝 Jellyfin.Server/Startup.cs (+8 -0)

📄 Description

Sets the default Accept header to application/json, */*
By default there is no Accept header.
*/* is needed for endpoints that would return an image instead of json.
This can be overridden locally as follows

var client = _httpClientFactory.CreateClient(NamedClient.Default);
using var request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaTypeNames.Application.Xml));
using var response = await client.SendAsync(request).ConfigureAwait(false);

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jellyfin/jellyfin/pull/4510 **Author:** [@crobibero](https://github.com/crobibero) **Created:** 11/19/2020 **Status:** ✅ Merged **Merged:** 11/22/2020 **Merged by:** [@joshuaboniface](https://github.com/joshuaboniface) **Base:** `master` ← **Head:** `http-accept-header` --- ### 📝 Commits (2) - [`c2d2c57`](https://github.com/jellyfin/jellyfin/commit/c2d2c571e7958eea1052a31dd78897d75d58fcdd) Set default request accept headers - [`c53b4f5`](https://github.com/jellyfin/jellyfin/commit/c53b4f55472e517744d4db8a4ce5e9cff31514bb) Add xml and quality ### 📊 Changes **1 file changed** (+8 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `Jellyfin.Server/Startup.cs` (+8 -0) </details> ### 📄 Description Sets the default `Accept` header to `application/json, */*` By default there is no `Accept` header. `*/*` is needed for endpoints that would return an image instead of json. This can be overridden locally as follows ```c# var client = _httpClientFactory.CreateClient(NamedClient.Default); using var request = new HttpRequestMessage(HttpMethod.Get, url); request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaTypeNames.Application.Xml)); using var response = await client.SendAsync(request).ConfigureAwait(false); ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-07 06:14:33 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#10126