GraphQL over HTTP Draft

GraphQL over HTTP 초안

A draft defines interoperable HTTP methods and response media types for GraphQL.

···
html
<div class="viz"><h3>GRAPHQL /graphql</h3><div class="row"><div class="box code" id="gql-request">GET query</div><span class="arrow">→</span><div class="box" id="gql-result">200<br>response+json</div></div><div class="muted" id="gql-note">query may use GET</div></div>
css
.viz{width:94%;height:88%;max-width:960px;padding:clamp(10px,2vmin,18px);border:1px solid var(--line);border-radius:14px;background:var(--surface);font:600 clamp(12px,1.35vw,16px)/1.35 var(--font-sans,system-ui,sans-serif);display:flex;flex-direction:column;gap:clamp(7px,1.8vmin,13px);overflow:hidden}.viz h3{margin:0;color:var(--accent);font:700 clamp(12px,1.35vw,16px)/1.2 var(--font-sans,system-ui,sans-serif);letter-spacing:.04em}.viz .row{display:flex;align-items:center;justify-content:center;gap:clamp(5px,1.4vmin,12px);flex:1;min-height:0}.viz .box{padding:clamp(5px,1.5vmin,12px);border:1px solid var(--line);border-radius:9px;background:var(--bg);text-align:center}.viz .muted{color:var(--muted)}.viz .accent{color:var(--accent)}.viz .code{font-family:ui-monospace,monospace}.viz .pill{padding:3px 7px;border:1px solid var(--line);border-radius:99px;white-space:nowrap}.viz .active{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 12%,var(--surface))}.viz .arrow{color:var(--accent);font:700 18px ui-monospace,monospace}#gql-request{min-width:35%}#gql-result{min-width:38%;border-color:var(--accent)}#gql-result.bad{border-color:var(--accent-3);color:var(--accent-3)}
js
const cases=[['GET query','200<br>response+json','query may use GET',false],['GET mutation','405<br>method rejected','mutation must not use GET',true],['POST mutation','200<br>response+json','POST is required',false]];let n=0;function draw(){const c=cases[n];document.getElementById('gql-request').textContent=c[0];const out=document.getElementById('gql-result');out.innerHTML=c[1];out.classList.toggle('bad',c[3]);document.getElementById('gql-note').textContent=c[2];n=(n+1)%cases.length}draw();setInterval(draw,1300)

The GraphQL core specification leaves transport undefined. The GraphQL over HTTP draft requires POST support, makes GET optional, and limits GET to query operations. Clients include application/graphql-response+json in Accept, and conforming servers support that response media type.

The demo accepts a GET query and POST mutation but rejects a GET mutation. This is still a Stage 2 draft and may change, so check actual server behavior and client compatibility.

When to use

Use it when aligning HTTP behavior across GraphQL clients and servers.

Open as page ↗