Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content-Type header ignored (UnsupportedMediaType returned) #32

Open
sanzoghenzo opened this issue Jul 8, 2019 · 2 comments
Open

Content-Type header ignored (UnsupportedMediaType returned) #32

sanzoghenzo opened this issue Jul 8, 2019 · 2 comments
Assignees

Comments

@sanzoghenzo
Copy link

Expected Behavior

I'm trying to use Dynaweb to talk to a RESTheart docker instance, in order to read/write to a mongoDB.

Following this (little outdated) tutorial, I'm trying to create a collection via
PUT http://localhost:8080/restheart/movies with JSON body {"desc": "my favorite movies"}.

The equivalent (working) curl call is:

curl -i -H "Content-Type: application/json" -X PUT http://localhost/restheart/movies -d '{"desc": "my favorite movies"}'

I'm expecting that using the example 5 and changing the url, endpoint, json string and method would work without issues.

Actual Behavior

The WebResponse returns a 415 UnsupportedMediaType status code, with content

{
  "http status code": 415,
  "http status description": "Unsupported Media Type",
  "message": "Content-Type must be either: application/hal+json or application/json"
}

It seems that Content-Type is not correctly passed as header.

Steps to Reproduce the Problem

  1. open the example 5 in dynamo studio (I also changed the execution type to manual)
  2. change the url to http://localhost:8080/restheart (the url pointing to the restheart instance+database name)
  3. change the endpoint to movies
  4. change the json string to {"desc": "my favorite movies"}
  5. change the metod to PUT
  6. run the project

Specifications

- DynaWeb: 1.0.3
- Dynamo : Dynamo Studio 1.3.3.4111
- Operating system :  Windows 10 1809
- .NET :  4.6.2
@radumg radumg self-assigned this Jul 8, 2019
@LeslieIng
Copy link

LeslieIng commented Oct 28, 2019

Hello! @sanzoghenzo and @radumg!

Did you ever solve your error?

I might have a similar problem with Dynaweb as the one described here.

I can succesfully receive an authentication response from an API, but when I add a Webrequest.Addparameter node in order to add a user_identifier I receive the following error:

Unsupported Media Type. Please set Content-Type header to application/json.

It appears as if the header is now skipped during the webrequest excecution, yet in the Webrequest.Parameters node the Content-Type is correctly displayed as being application/json.

I tried playing around with the order of the nodes, but I don't think that should matter, right?

Maybe I am overlooking something very simple?

Kind regards,

Leslie

@radumg
Copy link
Owner

radumg commented Oct 28, 2019

hey chaps, it seems the AddParameter node has been exhibiting some strange behaviour on multiple fronts, I'll try and have a look and see what's going on.

note to self : might be related to #31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants