Questions tagged [content-type]

The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent had the request been a GET.

Filter by
Sorted by
Tagged with
0 votes
0 answers
12 views

WriterInterceptorExecutor: MessageBodyWriter not found for media type=text/csv

I am getting the following error org.glassfish.jersey.message.internal.WriterInterceptorExecutor: MessageBodyWriter not found for media type=text/csv, type=class java.io.PrintWriter, genericType=class ...
0 votes
0 answers
9 views

Where can I find some fetch documentation on autogenerated content-type? [duplicate]

If I write some code to do a fetch for some multipart/form-data which looks like: const authorization = btoa('AAAAA:BBBBB') const data = new FormData() data.append('grant_type', 'password') data....
  • 151
0 votes
0 answers
19 views

The difference in Content-Type between request and response

I am intercepting network requests and analyzing its response. It is not very clear what factors will cause the "type" difference between the above two. The following is an example of a ...
2 votes
1 answer
80 views

How to create endpoint with different response content types depending on accept header in Java with Micronaut

I am having a play with Micronaut, and want to create an endpoint that returns either text/plain or text/html, depending on the Accept header in the request. I found two ways to do this: create two ...
  • 31
0 votes
1 answer
26 views

Invalid token character ':' in org.springframework.http.MediaType [duplicate]

I have a basic SpringBoot 2.3.4.RELEASE app. Using Spring Initializer, JPA, embedded Tomcat; I want to create this MediaType MediaType customMediaType = MediaType.parseMediaType("application/json;...
0 votes
1 answer
70 views

"Content-Type" for HEAD request

I'm building a REST API. Before calling a GET endpoint a HEAD request should be sent. What kind of "Content-Type" parameter should a HEAD request provide?
0 votes
0 answers
19 views

How MVC Controller understands when to respond with redirect (for HTML form) and when with JSON (for API/AJAX requests)

In websites, data can be sent using an HTML form to POST /createUser with a payload in the body, and expect a redirect to some page (for example, to a newly created user) in response. Or you can send ...
  • 380
-1 votes
1 answer
276 views

FastAPI: Why Content-Type header is required in a JSON POST request?

I have the following FastAPI application: from pydantic import BaseModel as Schema from fastapi import FastAPI api = FastAPI() class User(Schema): firstname: str lastname: str age: int | ...
  • 7
0 votes
1 answer
57 views

Change document type with PHP using URL file extension

I am trying to change the document type using PHP by getting string from URL. This because i made a one page php website. All the contents will load up in one single index.php whether it is HTML file, ...
0 votes
0 answers
153 views

Failed to load module script: Expected a JavaScript module for a stencil application

I have a stencil Application where on build the files are moved to s3, i see in my cloud formation template while uploading the content type is set as application/javascript. name": "stencil-...
  • 18.7k
0 votes
0 answers
21 views

Why browser downloads the image on S3 instead of displaying it?

This is my NodeJS app for uploading the image: import AWS from 'aws-sdk'; import fs, { ReadStream } from "fs"; import path from "path"; const bucketName = "mybucketname";...
0 votes
1 answer
122 views

Vite serving shader file with wrong (none) MIME type

I'm developing a BabylonJS application. BabylonJS PostProcess class appends .fragment.fx to a given file name and requests that from the server. When my local Vite (version 4.0.4) dev server serves ...
  • 25.9k
1 vote
1 answer
66 views

React-Native, axios Post FormData with a different Content-Type of each parts

I have an api to upload some documents, I create a FormDdata variable with 2 keys: documentInfo (an object contain user info) and files(contain document info. I try with Postman and it success with ...
0 votes
2 answers
75 views

Return HTML from an Azure Function in c#

I wrote an Azure function in c# which returns html. When I make a request from a web browser, it displays the full response as raw text instead of rendering it as html. I think I need to set the ...
1 vote
2 answers
521 views

Content-Type 'application/json;charset=UTF-8' is not supported SpringBoot Rest

I have this exception when I'm trying to send POST or PUT request on RestController I don't use Jackson which solve all other similar problem on SOF. Controller: ` @RequestMapping("/api/v1/...
0 votes
0 answers
60 views

How do I change the content-type in Spring/Thymeleaf?

I have a Spring/Thymeleaf based site serving dynamically generated HTML pages. I have a JavaScript script with a data structure that I want to fill in with server side data. I figured out how to make ...
0 votes
1 answer
34 views

How to use two ContentTypes in one JSP(web app on Spring MVC): text/html && application/json

I'm developing a simple crud app without frontend, but I want to have a very simple visual for myself and the viewers. Now I have created a simple jsp-file with a set of tags 'a'. It was not difficult ...
0 votes
0 answers
91 views

Dynamically override content-type response header in AWS CloudFront

I'm using AWS S3 and CloudFront to distribute content. My files stored in S3 have binary/octet-stream type but in fact they can be images or documents. When generating S3 URLs, I can override the ...
  • 745
0 votes
1 answer
471 views

ReactJS http-proxy-middleware request header not set properly

TL;DR: How to actually change a request header in http-proxy-middleware? To get around some CORS errors I set up a local proxy using the http-proxy-middleware module. In addition to setting the mode ...
  • 1,034
0 votes
0 answers
16 views

How to pass value to a [FormBody] variable from RestAssured?

I have a web api method as given below // POST api/values public void Post([FromBody] string value) { names = names.Concat( new string[] { value } ).ToArray(); } ...
0 votes
0 answers
40 views

CORB is blocking image rendering of an image when requested from another domain I own

CORB is blocking image rendering of an image when requested from another domain I own. The image request is through a REST api that is proxying the image since it's actual source is in AWS S3. Url ...
0 votes
0 answers
18 views

Google Domain Forwarding - with Content-Type JSON

I have a domain foo.com registered with google domains. I have configured it to forward to myfoo.com (including path forwarding, etc.). When HTTP requests are sent, it successfully forwards foo.com --&...
-2 votes
1 answer
80 views

Rest API : Post API Throwing 400 Bad request

Use Case - I am having a post API which is supposed to consume Content-Type = x-www-form-urlencoded. When creating individual boot project and implementing POST API, I am getting Form Data in my ...
0 votes
1 answer
175 views

Logic App Http POST request UnsupportedMediaType error

I am getting the following error in my logic app: { "type": "https://errors-api.cloud.com/common/unsupportedMediaType", "detail": "Content type '' not supported"...
0 votes
0 answers
33 views

How to get Content-Type, boundary value from headers using javascript

"Content-Type": "multipart/form-data; boundary=------------------------748452847948609677635397", Is there any way to get only boundary value from headers? I can't figure it out. ...
  • 55
3 votes
2 answers
861 views

How to set "custom" Content-Type of an HttpClient request in DOT NET CORE?

I'm trying to set Content-Type as "application/x.example.hr.employee.email+json;version=1" of an HttpClient request as required by the API I am calling. The API is of type GET and accepts a ...
  • 131
0 votes
0 answers
107 views

feign client put specific content-type=image/jpeg or content-type=image/png orcontent-type=image/gif

the service provider consumes exact content-type image/jpeg or image/png ,image/gif. if the content-type is multipart/form-data then the service provider could not prosess; And this is my Feign ...
1 vote
0 answers
191 views

Unable to read request body of HttpServletRequest multiple times in case of multipart/form-data

I know there are plenty of examples to read request body multiple times, I have gone through alot but couldn't find the solution to my problem. So, in my case i have a spring-boot project which ...
0 votes
0 answers
86 views

How to fix the diamond question marks and special characters when users upload emojis

I have a JS script that uploads a JSON array to the blockchain / not a database. But when a user uploads an emoji it returns as a diamond question mark or rectangle with X etc.. Is this coming from ...
  • 741
1 vote
1 answer
63 views

java.lang.AssertionError: ContentType not set

I am using JUnit, MockMvc, SpyBean and Captor to test a method that saves a new Drone object in the repository. The method is this: @RestController @RequestMapping("/drone") public class ...
2 votes
0 answers
231 views

drf-spectacular define request content type as 'application/x-www-form-urlencoded'

In drf-spectacular swagger, post method have 3 content types as below application/json application/x-www-form-urlencoded multipart/form-data Is there anyway to make "application/x-www-form-...
0 votes
0 answers
22 views

Why is the first parameter of a $.get callback function not equal to the server response?

I make the following requests: $.when( $.get("/locator1"), $.get("/locator2") ).done(function(locator1Location, locator2Location) { const url1 = ...
  • 2,929
0 votes
1 answer
316 views

When trying to download certain video it redirects to a new URL and the video starts to play. "disposable content type" is not received from server

I want to download certain videos with a click. For that, I created a Button and attached a Function that should trigger the associated video download. But I am only able to download the link of the ...
  • 1,071
1 vote
1 answer
235 views

Assigning Azure Blob Storage Content-Type with Terraform Dynamically

Is there a way to set the content-type for Azure Blob Storage using Terraform that dynamically infers the file extension ? Currently it just defaults to "application/octet-stream" which ...
0 votes
1 answer
31 views

How to corectly set the ContentType property in HttpWebRequest (or how to fix the missing Content-Type header)

I thought I'd share something that took me some time to figure out: I wrote a simple Post method using HttpWebRequest class. In HttpWebRequest you can't use HttpWebRequest.Headers collection to set ...
0 votes
1 answer
87 views

Sending "content-type" as "application/json" via XMLHttpRequest() to a Google Cloud Function is causing a KeyError: 'CONTENT_TYPE'

I have a JavaScript app in an html file that I'm using to send requests to a Google Cloud Function. This works as intended and the cloud function is triggered. I am currently doing xhr....
0 votes
0 answers
429 views

Allowing HTTP Header Content Type */* in Azure WAF Rules

I am trying to call the Azure-hosted API endpoint using a 3rd party application. Application sends the HTTP request with the header values ContentType = "*/*"; Azure Application Gateway WAF ...
  • 3,081
0 votes
0 answers
29 views

Model name of objects in django vews.py querysets

I'm trying to use django-taggit package for several applications on the site. I have two taggable models: Article, News (actually, more, but it does not matter). class TagListView(TagMixin, ListView): ...
0 votes
1 answer
114 views

Django: How to override the MIME type of a user uploaded file?

Users on my web dev forum can upload HTML files as attachments to their posts, to show their code. This is done through a Django FileField. How can I ensure that these uploads are then served with &...
  • 300
0 votes
0 answers
97 views

How do I make a query to get multiple content type in spfx? #pnp

I am making a project with React and Typescript (SPFX) and I have created a webpart with about 4 components and each component has a different Content type id. At the moment, I need to make a query ...
0 votes
0 answers
31 views

Unseen content type -- */*;charset=gb2312

I recently came across this content type -- /;charset=gb2312 I've never seen it before and wondered if it's valid for what would normally be a "text/html" content type. I understand gb2312 ...
  • 888
1 vote
1 answer
1k views

Axios interceptor changes the POST request's content type on 401 retry

I cannot figure out why Axios is changing my request's content-type on retry. I am creating an axios instance as follows (notice global default header): import axios, { type AxiosInstance } from "...
  • 1,077
1 vote
1 answer
822 views

Content Type Builder on Strapi production server

Hi i'm new on strapi and i have a problem. I have a strapi application in production mode so i can't use the Content Type Builder. I wanna know if is possible to modify the Content Type and how to do ...
-1 votes
1 answer
156 views

Using NFTStorage WebApi (upload) with some problem and get an error "Response status code does not indicate success: 500 (Internal Server Error)."

And i use Postman to test is Body using "form-data" and "key" is file "value" is upload ur file, Headers u should set "Key" is Authorization "value" ...
1 vote
0 answers
165 views

REST Response adds \ - Media Type application/json vs text/plain

I have an endpoint that returns the following response, curl -X 'POST' \ 'https://localhost:7135/api/v1/Initiate' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' returns &...
  • 3,543
1 vote
1 answer
539 views

How can I force a content type on the response?

I use an API which returns text/plain for its content type even though it's actually application/xml (XML format). If I change the content type dropdown in Postman to XML, it displays in the "...
  • 115
0 votes
0 answers
480 views

Change content-type of a Response from "text/html" to "application/json"

i have my string text in my variable in C#: string readText = File.ReadAllText(path); return readText; When i call this from my FE, the response type is text/html. How can i change it in "...
1 vote
0 answers
301 views

Can't set Response Content-Type text/event-stream for Controller Action in .Net 6 WebAPI

I use .Net 6 WebAPI. I want to create an action in a controller that is going to be used from client javascript Server Sent Events creating a EventSource(urlToControllerActionGoesHere). My action I ...
  • 351
2 votes
1 answer
675 views

How to set Content-Type Header in Java MicroProfile RestClient during method call

I am currently using the Java MicroProfile RestClient and have following problem: Backend provides an api to receive binary files Backend would be happy to receive a Content-Type header containing ...
0 votes
0 answers
16 views

how would the content type might be determined if the Content-Type header is not set?

there is a question in an old exam paper which states "Suggest and explain how the content type might be determined if the Content-Type header is not set." Would anyone know the answer to ...

1
2 3 4 5
47