[{"data":1,"prerenderedAt":552},["ShallowReactive",2],{"docs:\u002Fdocs\u002Fresponses":3,"i-lucide:moon":543,"i-lucide:github":548,"i-lucide:menu":550},{"id":4,"title":5,"body":6,"description":536,"extension":537,"meta":538,"navigation":118,"path":539,"seo":540,"stem":541,"__hash__":542},"docs\u002Fdocs\u002Fresponses.md","Responses",{"type":7,"value":8,"toc":531},"minimark",[9,18,23,26,40,143,147,169,277,288,305,389,393,407,502,510,527],[10,11,12,13,17],"p",{},"The generated client exposes each route call with a few response shapes. Pick the one that matches the calling code instead of hand-writing ",[14,15,16],"code",{},"$fetch"," calls.",[19,20,22],"h2",{"id":21},"success-body","Success body",[10,24,25],{},"Awaiting the call directly returns the declared success body. This is the smallest shape for UI code that only cares about a successful result.",[10,27,28,29,32,33,35,36,39],{},"All JSON response helpers expose wire types. For example, a server response schema whose output contains ",[14,30,31],{},"Date"," is validated as ",[14,34,31],{}," in the handler and received as ",[14,37,38],{},"string"," by the client. The same conversion applies to status-specific error bodies.",[41,42,47],"pre",{"className":43,"code":44,"language":45,"meta":46,"style":46},"language-ts shiki shiki-themes github-light-default github-dark-default","const user = await $endpoint('\u002Fapi\u002Fusers\u002F:id', {\n  method: 'get',\n  params: { id: '123' },\n})\n\nuser.id.toFixed()\nuser.name.toUpperCase()\n","ts","",[14,48,49,83,95,107,113,120,132],{"__ignoreMap":46},[50,51,54,58,62,65,68,72,76,80],"span",{"class":52,"line":53},"line",1,[50,55,57],{"class":56},"swxxe","const",[50,59,61],{"class":60},"sOOdx"," user",[50,63,64],{"class":56}," =",[50,66,67],{"class":56}," await",[50,69,71],{"class":70},"s9HWX"," $endpoint",[50,73,75],{"class":74},"saQ_J","(",[50,77,79],{"class":78},"sZItA","'\u002Fapi\u002Fusers\u002F:id'",[50,81,82],{"class":74},", {\n",[50,84,86,89,92],{"class":52,"line":85},2,[50,87,88],{"class":74},"  method: ",[50,90,91],{"class":78},"'get'",[50,93,94],{"class":74},",\n",[50,96,98,101,104],{"class":52,"line":97},3,[50,99,100],{"class":74},"  params: { id: ",[50,102,103],{"class":78},"'123'",[50,105,106],{"class":74}," },\n",[50,108,110],{"class":52,"line":109},4,[50,111,112],{"class":74},"})\n",[50,114,116],{"class":52,"line":115},5,[50,117,119],{"emptyLinePlaceholder":118},true,"\n",[50,121,123,126,129],{"class":52,"line":122},6,[50,124,125],{"class":74},"user.id.",[50,127,128],{"class":70},"toFixed",[50,130,131],{"class":74},"()\n",[50,133,135,138,141],{"class":52,"line":134},7,[50,136,137],{"class":74},"user.name.",[50,139,140],{"class":70},"toUpperCase",[50,142,131],{"class":74},[19,144,146],{"id":145},"typed-result","Typed result",[10,148,149,150,153,154,157,158,157,161,164,165,168],{},"Use ",[14,151,152],{},".result()"," when the endpoint declares multiple statuses and the caller needs to branch on the status code. The result includes ",[14,155,156],{},"status",", ",[14,159,160],{},"ok",[14,162,163],{},"body",", and ",[14,166,167],{},"headers",".",[41,170,172],{"className":43,"code":171,"language":45,"meta":46,"style":46},"const result = await $endpoint('\u002Fapi\u002Fusers\u002F:id', {\n  method: 'get',\n  params: { id: '404' },\n}).result()\n\nif (result.status === 404) {\n  result.body.message\n}\nif (result.status === 200) {\n  result.body.name\n}\n",[14,173,174,193,201,210,220,224,241,246,252,266,272],{"__ignoreMap":46},[50,175,176,178,181,183,185,187,189,191],{"class":52,"line":53},[50,177,57],{"class":56},[50,179,180],{"class":60}," result",[50,182,64],{"class":56},[50,184,67],{"class":56},[50,186,71],{"class":70},[50,188,75],{"class":74},[50,190,79],{"class":78},[50,192,82],{"class":74},[50,194,195,197,199],{"class":52,"line":85},[50,196,88],{"class":74},[50,198,91],{"class":78},[50,200,94],{"class":74},[50,202,203,205,208],{"class":52,"line":97},[50,204,100],{"class":74},[50,206,207],{"class":78},"'404'",[50,209,106],{"class":74},[50,211,212,215,218],{"class":52,"line":109},[50,213,214],{"class":74},"}).",[50,216,217],{"class":70},"result",[50,219,131],{"class":74},[50,221,222],{"class":52,"line":115},[50,223,119],{"emptyLinePlaceholder":118},[50,225,226,229,232,235,238],{"class":52,"line":122},[50,227,228],{"class":56},"if",[50,230,231],{"class":74}," (result.status ",[50,233,234],{"class":56},"===",[50,236,237],{"class":60}," 404",[50,239,240],{"class":74},") {\n",[50,242,243],{"class":52,"line":134},[50,244,245],{"class":74},"  result.body.message\n",[50,247,249],{"class":52,"line":248},8,[50,250,251],{"class":74},"}\n",[50,253,255,257,259,261,264],{"class":52,"line":254},9,[50,256,228],{"class":56},[50,258,231],{"class":74},[50,260,234],{"class":56},[50,262,263],{"class":60}," 200",[50,265,240],{"class":74},[50,267,269],{"class":52,"line":268},10,[50,270,271],{"class":74},"  result.body.name\n",[50,273,275],{"class":52,"line":274},11,[50,276,251],{"class":74},[10,278,279,280,283,284,287],{},"This helper is generated by default. Set ",[14,281,282],{},"endpoints.client.result"," to ",[14,285,286],{},"false"," if the project only wants the default body call.",[10,289,290,291,294,295,157,297,164,299,301,302,168],{},"For Nuxt async data, use ",[14,292,293],{},"useEndpointResult",". It keeps ",[14,296,156],{},[14,298,160],{},[14,300,163],{}," typed, but does not include non-serializable ",[14,303,304],{},"Headers",[41,306,308],{"className":43,"code":307,"language":45,"meta":46,"style":46},"const { data: result } = await useEndpointResult('\u002Fapi\u002Fusers\u002F:id', {\n  method: 'get',\n  params: { id: '123' },\n})\n\nif (result.value?.status === 404) {\n  result.value.body.message\n}\n",[14,309,310,343,351,359,363,367,380,385],{"__ignoreMap":46},[50,311,312,314,317,321,324,326,329,332,334,337,339,341],{"class":52,"line":53},[50,313,57],{"class":56},[50,315,316],{"class":74}," { ",[50,318,320],{"class":319},"sVS1I","data",[50,322,323],{"class":74},": ",[50,325,217],{"class":60},[50,327,328],{"class":74}," } ",[50,330,331],{"class":56},"=",[50,333,67],{"class":56},[50,335,336],{"class":70}," useEndpointResult",[50,338,75],{"class":74},[50,340,79],{"class":78},[50,342,82],{"class":74},[50,344,345,347,349],{"class":52,"line":85},[50,346,88],{"class":74},[50,348,91],{"class":78},[50,350,94],{"class":74},[50,352,353,355,357],{"class":52,"line":97},[50,354,100],{"class":74},[50,356,103],{"class":78},[50,358,106],{"class":74},[50,360,361],{"class":52,"line":109},[50,362,112],{"class":74},[50,364,365],{"class":52,"line":115},[50,366,119],{"emptyLinePlaceholder":118},[50,368,369,371,374,376,378],{"class":52,"line":122},[50,370,228],{"class":56},[50,372,373],{"class":74}," (result.value?.status ",[50,375,234],{"class":56},[50,377,237],{"class":60},[50,379,240],{"class":74},[50,381,382],{"class":52,"line":134},[50,383,384],{"class":74},"  result.value.body.message\n",[50,386,387],{"class":52,"line":248},[50,388,251],{"class":74},[19,390,392],{"id":391},"raw-web-response","Raw Web Response",[10,394,149,395,398,399,402,403,406],{},[14,396,397],{},".raw()"," when code needs a native ",[14,400,401],{},"Response"," shape, such as streaming, headers-first logic, or passing the result into lower-level utilities. For contracted JSON responses, the ",[14,404,405],{},"json()"," return type follows the serialized wire representation of the endpoint response schema.",[41,408,410],{"className":43,"code":409,"language":45,"meta":46,"style":46},"const response = await $endpoint('\u002Fapi\u002Fusers\u002F:id', {\n  method: 'get',\n  params: { id: '123' },\n}).raw()\n\nif (response.status === 200) {\n  const body = await response.json()\n  body.id\n}\n",[14,411,412,431,439,447,456,460,473,493,498],{"__ignoreMap":46},[50,413,414,416,419,421,423,425,427,429],{"class":52,"line":53},[50,415,57],{"class":56},[50,417,418],{"class":60}," response",[50,420,64],{"class":56},[50,422,67],{"class":56},[50,424,71],{"class":70},[50,426,75],{"class":74},[50,428,79],{"class":78},[50,430,82],{"class":74},[50,432,433,435,437],{"class":52,"line":85},[50,434,88],{"class":74},[50,436,91],{"class":78},[50,438,94],{"class":74},[50,440,441,443,445],{"class":52,"line":97},[50,442,100],{"class":74},[50,444,103],{"class":78},[50,446,106],{"class":74},[50,448,449,451,454],{"class":52,"line":109},[50,450,214],{"class":74},[50,452,453],{"class":70},"raw",[50,455,131],{"class":74},[50,457,458],{"class":52,"line":115},[50,459,119],{"emptyLinePlaceholder":118},[50,461,462,464,467,469,471],{"class":52,"line":122},[50,463,228],{"class":56},[50,465,466],{"class":74}," (response.status ",[50,468,234],{"class":56},[50,470,263],{"class":60},[50,472,240],{"class":74},[50,474,475,478,481,483,485,488,491],{"class":52,"line":134},[50,476,477],{"class":56},"  const",[50,479,480],{"class":60}," body",[50,482,64],{"class":56},[50,484,67],{"class":56},[50,486,487],{"class":74}," response.",[50,489,490],{"class":70},"json",[50,492,131],{"class":74},[50,494,495],{"class":52,"line":248},[50,496,497],{"class":74},"  body.id\n",[50,499,500],{"class":52,"line":254},[50,501,251],{"class":74},[10,503,279,504,283,507,509],{},[14,505,506],{},"endpoints.client.raw",[14,508,286],{}," to remove it from the client surface.",[10,511,512,513,516,517,520,521,523,524,526],{},"There is no ",[14,514,515],{},"useEndpointRaw",". Raw Web Responses are intentionally kept on ",[14,518,519],{},"$endpoint(...).raw()"," because native ",[14,522,401],{}," and ",[14,525,304],{}," values do not fit Nuxt async-data payloads cleanly.",[528,529,530],"style",{},"html pre.shiki code .swxxe, html code.shiki .swxxe{--shiki-light:#CF222E;--shiki-dark:#FF7B72}html pre.shiki code .sOOdx, html code.shiki .sOOdx{--shiki-light:#0550AE;--shiki-dark:#79C0FF}html pre.shiki code .s9HWX, html code.shiki .s9HWX{--shiki-light:#8250DF;--shiki-dark:#D2A8FF}html pre.shiki code .saQ_J, html code.shiki .saQ_J{--shiki-light:#1F2328;--shiki-dark:#E6EDF3}html pre.shiki code .sZItA, html code.shiki .sZItA{--shiki-light:#0A3069;--shiki-dark:#A5D6FF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sVS1I, html code.shiki .sVS1I{--shiki-light:#953800;--shiki-dark:#FFA657}",{"title":46,"searchDepth":85,"depth":85,"links":532},[533,534,535],{"id":21,"depth":85,"text":22},{"id":145,"depth":85,"text":146},{"id":391,"depth":85,"text":392},"Choose between success bodies, status-aware typed results, and raw Web Responses.","md",{},"\u002Fdocs\u002Fresponses",{"title":5,"description":536},"docs\u002Fresponses","OjO8-3_7vHr2HmkGjBIrNJa2LgtW2iE1hvMccRKtRDU",{"left":544,"top":544,"width":545,"height":545,"rotate":544,"vFlip":546,"hFlip":546,"body":547},0,24,false,"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401\"\u002F>",{"left":544,"top":544,"width":545,"height":545,"rotate":544,"vFlip":546,"hFlip":546,"body":549,"hidden":118},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Cpath d=\"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5c.08-1.25-.27-2.48-1-3.5c.28-1.15.28-2.35 0-3.5c0 0-1 0-3 1.5c-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.4 5.4 0 0 0 4 9c0 3.5 3 5.5 6 5.5c-.39.49-.68 1.05-.85 1.65S8.93 17.38 9 18v4\"\u002F>\u003Cpath d=\"M9 18c-4.51 2-5-2-7-2\"\u002F>\u003C\u002Fg>",{"left":544,"top":544,"width":545,"height":545,"rotate":544,"vFlip":546,"hFlip":546,"body":551},"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 5h16M4 12h16M4 19h16\"\u002F>",1787723882292]