You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Klaus Ma (JIRA)" <ji...@apache.org> on 2015/10/18 16:22:06 UTC
[jira] [Commented] (MESOS-3739) Mesos does not set Content-Type for
400 Bad Request
[ https://issues.apache.org/jira/browse/MESOS-3739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14962402#comment-14962402 ]
Klaus Ma commented on MESOS-3739:
---------------------------------
It seems only OK have the ContextType for JSON; propose to following the same rules of json for others.
1. By default, it's {{text/plain}}
2. Build a class named {{Context}} and sub-class such as {{Html}}, so {{BadRequest}} can get ContextType from by the type
{code}
class Context
{
public:
virtual std::string type()
{
return "text/plain";
}
}
class Html : public Context
{
public:
virtual std::string type()
{
return "text/html";
}
}
public OK : Response
{
public:
OK(Html body)
{
headers["Context-type"] = body.type();
}
}
{code}
> Mesos does not set Content-Type for 400 Bad Request
> ---------------------------------------------------
>
> Key: MESOS-3739
> URL: https://issues.apache.org/jira/browse/MESOS-3739
> Project: Mesos
> Issue Type: Bug
> Components: HTTP API
> Affects Versions: 0.24.0, 0.24.1, 0.25.0
> Reporter: Ben Whitehead
>
> While integrating with the HTTP Scheduler API I encountered the following scenario.
> The message below was serialized to protobuf and sent as the POST body
> {code:title=message}
> call {
> type: ACKNOWLEDGE,
> acknowledge: {
> uuid: <bytes>,
> agentID: { value: "20151012-182734-16777343-5050-8978-S2" },
> taskID: { value: "task-1" }
> }
> }
> {code}
> {code:title=Request Headers}
> POST /api/v1/scheduler HTTP/1.1
> Content-Type: application/x-protobuf
> Accept: application/x-protobuf
> Content-Length: 73
> Host: localhost:5050
> User-Agent: RxNetty Client
> {code}
> I received the following response
> {code:title=Response Headers}
> HTTP/1.1 400 Bad Request
> Date: Wed, 14 Oct 2015 23:21:36 GMT
> Content-Length: 74
> Failed to validate Scheduler::Call: Expecting 'framework_id' to be present
> {code}
> Even though my accept header made no mention of {{text/plain}} the message body returned to me is {{text/plain}}. Additionally, there is no {{Content-Type}} header set on the response so I can't even do anything intelligently in my response handler.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)