[{"data":1,"prerenderedAt":1377},["ShallowReactive",2],{"page:\u002Fextensions\u002Fkubb-labs\u002Fplugin-fetch\u002Fguides\u002Fmigrate-to-v6":3},{"id":4,"frontmatter":5,"title":6,"heading":6,"body":7,"path":1376,"source":4},"extensions\u002Fkubb-labs\u002Fplugin-fetch\u002Fguides\u002Fmigrate-to-v6.md",{},"Migrate to v6",{"type":8,"value":9,"toc":1354},"minimark",[10,27,34,39,157,160,627,636,835,838,859,874,884,887,892,907,922,937,947,951,954,1114,1117,1239,1246,1250,1265,1269,1273,1276,1312,1316,1319,1338,1342],[11,12,13,14,18,19,22,23,26],"p",{},"Upgrade ",[15,16,17],"code",{},"@kubb\u002Fplugin-fetch"," from v5 to v6, which runs on the shared client core from ",[15,20,21],{},"@kubb\u002Fplugin-client",", the same core as ",[15,24,25],{},"@kubb\u002Fplugin-axios",".",[11,28,29,30,33],{},"Code that only calls the generated functions, SDK classes, or hooks needs a regenerate. Code that configures ",[15,31,32],{},"client",", adds media types, streams, or writes a transport needs the edits below.",[35,36,38],"h2",{"id":37},"upgrade-steps","Upgrade steps",[40,41,43,48,57,96,100,107,120,124,127,139,143],"steps",{"level":42},"3",[44,45,47],"h3",{"id":46},"upgrade-the-packages","Upgrade the packages",[11,49,13,50,53,54,56],{},[15,51,52],{},"kubb"," and ",[15,55,17],{}," together. v6 needs Kubb 5.19.0 or later:",[58,59,63],"pre",{"language":60,"code":61,"class":62},"bash","npm install --save-dev kubb@latest @kubb\u002Fplugin-fetch@6","highlights",[15,64,66],{"class":65},"language-bash",[67,68,71,75,79,82,85,87,90,92],"span",{"class":69,"style":70},"line","display: inline",[67,72,74],{"style":73},"color:#6f42c1;--hls-dark:#b392f0","npm ",[67,76,78],{"style":77},"color:#24292e;--hls-dark:#e1e4e8","install --save-dev kubb",[67,80,81],{"style":77},"@",[67,83,84],{"style":77},"latest ",[67,86,81],{"style":77},[67,88,89],{"style":77},"kubb\u002Fplugin-fetch",[67,91,81],{"style":77},[67,93,95],{"style":94},"color:#005cc5;--hls-dark:#79b8ff","6",[44,97,99],{"id":98},"regenerate","Regenerate",[11,101,102,103,106],{},"This rewrites ",[15,104,105],{},".kubb\u002F"," and the operation files:",[58,108,110],{"language":60,"code":109,"class":62},"npx kubb generate",[15,111,112],{"class":65},[67,113,114,117],{"class":69,"style":70},[67,115,116],{"style":73},"npx ",[67,118,119],{"style":77},"kubb generate",[44,121,123],{"id":122},"run-the-type-checker","Run the type checker",[11,125,126],{},"Most breaking changes show up as compile errors:",[58,128,130],{"language":60,"code":129,"class":62},"npx tsc --noEmit",[15,131,132],{"class":65},[67,133,134,136],{"class":69,"style":70},[67,135,116],{"style":73},[67,137,138],{"style":77},"tsc --noEmit",[44,140,142],{"id":141},"fix-each-error","Fix each error",[11,144,145,146,151,152,156],{},"Find its row in ",[147,148,150],"a",{"href":149},"#what-to-change","What to change",". Then check the ",[147,153,155],{"href":154},"#behavior-changes","behavior changes",", which compile without errors.",[35,158,150],{"id":159},"what-to-change",[161,162,163,176],"table",{},[164,165,166],"thead",{},[167,168,169,173],"tr",{},[170,171,172],"th",{},"You used",[170,174,175],{},"Now",[177,178,179,193,213,251,269,288,304,329,341,358,379,400,429,449,468,493,515,540,563,584,607],"tbody",{},[167,180,181,187],{},[182,183,184],"td",{},[15,185,186],{},"@kubb\u002Fplugin-fetch\u002Ftemplates\u002Ffetch.ts",[182,188,189,192],{},[15,190,191],{},"@kubb\u002Fplugin-fetch\u002Ftemplates\u002Fclient.ts",". Types only.",[167,194,195,208],{},[182,196,197,200,201,204,205],{},[15,198,199],{},"@kubb\u002Fplugin-fetch\u002Ftemplates\u002Fcore.ts",", ",[15,202,203],{},"serializers.ts",", or ",[15,206,207],{},"standardSchema.ts",[182,209,210,192],{},[15,211,212],{},"@kubb\u002Fplugin-client\u002Ftemplates\u002F*",[167,214,215,225],{},[182,216,217,218,221,222],{},"A ",[15,219,220],{},"transport"," that returns ",[15,223,224],{},"{ data, status, ... }",[182,226,227,228,204,231,234,235,238,239,242,243,246,247,250],{},"Return a web ",[15,229,230],{},"Response",[15,232,233],{},"{ webResponse, request, response }",". Build the ",[15,236,237],{},"RequestInit"," with ",[15,240,241],{},"toRequestInit(request)",". Response interceptors get a ",[15,244,245],{},"DecodedResponse",", the shape ",[15,248,249],{},"TransportResult"," had.",[167,252,253,262],{},[182,254,255,258,259],{},[15,256,257],{},"client.interceptors.error"," handlers that read ",[15,260,261],{},"status",[182,263,264,265,268],{},"Narrow with ",[15,266,267],{},"ResponseError.is"," first. They also get network errors, aborts, and validation errors.",[167,270,271,276],{},[182,272,273],{},[15,274,275],{},"FetchOptions",[182,277,278,281,282,284,285,26],{},[15,279,280],{},"NativeOptions",", the same type: ",[15,283,237],{}," plus Next.js's ",[15,286,287],{},"next",[167,289,290,295],{},[182,291,292],{},[15,293,294],{},"defaultQuerySerializer",[182,296,297,204,300,303],{},[15,298,299],{},"serializeQuery",[15,301,302],{},"serializeStyledQuery"," for a styled query parameter.",[167,305,306,311],{},[182,307,308],{},[15,309,310],{},"defaultPathSerializer",[182,312,313,316,317,320,321,324,325,328],{},[15,314,315],{},"serializePath",", plus ",[15,318,319],{},"serializeStyledPath"," for a ",[15,322,323],{},"label"," or ",[15,326,327],{},"matrix"," parameter.",[167,330,331,336],{},[182,332,333],{},[15,334,335],{},"applyHeaderStyles",[182,337,338],{},[15,339,340],{},"serializeHeaders",[167,342,343,348],{},[182,344,345],{},[15,346,347],{},"codecs",[182,349,350,353,354,26],{},[15,351,352],{},"mediaTypes",". See ",[147,355,357],{"href":356},"#media-types","Media types",[167,359,360,374],{},[182,361,362,200,365,200,368,200,371],{},[15,363,364],{},"Codec",[15,366,367],{},"Deserializer",[15,369,370],{},"ContentBodySerializer",[15,372,373],{},"BodySerializer",[182,375,376],{},[15,377,378],{},"MediaType",[167,380,381,392],{},[182,382,383,200,386,200,389],{},[15,384,385],{},"serializer.body",[15,387,388],{},"defaultBodySerializer",[15,390,391],{},"isDefaultJsonBody",[182,393,217,394,396,397,26],{},[15,395,352],{}," entry, or ",[15,398,399],{},"defaultMediaTypes",[167,401,402,416],{},[182,403,404,200,407,200,410,200,413],{},[15,405,406],{},"responseType",[15,408,409],{},"ResponseType",[15,411,412],{},"ResponseTypeMap",[15,414,415],{},"resolveResponseType",[182,417,418,53,421,424,425,428],{},[15,419,420],{},"parseAs",[15,422,423],{},"ParseAs",", such as ",[15,426,427],{},"parseAs: 'blob'",", or a media type.",[167,430,431,436],{},[182,432,433],{},[15,434,435],{},"formMediaTypes",[182,437,438,53,441,444,445,448],{},[15,439,440],{},"multipartFormData",[15,442,443],{},"urlencoded",", written to ",[15,446,447],{},".kubb\u002FmediaTypes\u002F"," when the spec has a form body.",[167,450,451,462],{},[182,452,453,200,456,200,459],{},[15,454,455],{},"CallResult",[15,457,458],{},"isStreamed",[15,460,461],{},"getResponseContentType",[182,463,464,465,26],{},"Removed. Read ",[15,466,467],{},"result.contentType",[167,469,470,481],{},[182,471,472,200,475,200,478],{},[15,473,474],{},"toEventStream",[15,476,477],{},"EventStreamCall",[15,479,480],{},"EventStreamResult",[182,482,483,53,486,353,489,26],{},[15,484,485],{},"client.stream",[15,487,488],{},"StreamResult",[147,490,492],{"href":491},"#streams","Streams",[167,494,495,509],{},[182,496,497,200,500,204,503,505,506],{},[15,498,499],{},"ServerSentEvent",[15,501,502],{},"TypedEvent",[15,504,488],{}," from ",[15,507,508],{},".kubb\u002Fsse.ts",[182,510,511,512,26],{},"Import them from ",[15,513,514],{},".kubb\u002Fclient.ts",[167,516,517,530],{},[182,518,217,519,522,523,526,527],{},[15,520,521],{},"…Status2XX"," type, or a ",[15,524,525],{},"'2XX'"," key in a responses record or ",[15,528,529],{},"validator.error",[182,531,532,533,53,536,539],{},"Lower case: ",[15,534,535],{},"…Status2xx",[15,537,538],{},"'2xx'",". Upper-case keys are ignored.",[167,541,542,554],{},[182,543,544,547,548,238,551],{},[15,545,546],{},"clients\u002Fpayment\u002F"," for tag ",[15,549,550],{},"payment",[15,552,553],{},"parent: store",[182,555,556,559,560,26],{},[15,557,558],{},"clients\u002Fstore\u002Fpayment\u002F",". To keep one folder per tag, pass ",[15,561,562],{},"group: { type: 'tag', name: ({ group }) => group }",[167,564,565,578],{},[182,566,567,570,571,574,575],{},[15,568,569],{},"types\u002FPoint.ts"," for operation ",[15,572,573],{},"point"," next to schema ",[15,576,577],{},"Point",[182,579,580,583],{},[15,581,582],{},"types\u002FPointOperation.ts",", whenever a schema file has the same name, in any case.",[167,585,586,597],{},[182,587,588,238,591,53,594],{},[15,589,590],{},"new pet(config)",[15,592,593],{},"sdk",[15,595,596],{},"group: { type: 'tag' }",[182,598,599,602,603,606],{},[15,600,601],{},"new PetClient(config)",". Files and root class fields, such as ",[15,604,605],{},"pet",", stay the same.",[167,608,609,616],{},[182,610,611,505,614],{},[15,612,613],{},"clientGenerator",[15,615,17],{},[182,617,618,619,53,622,505,625,26],{},"Removed. Build on ",[15,620,621],{},"setupClient",[15,623,624],{},"clientDependencies",[15,626,21],{},[11,628,629,630,632,633,635],{},"Runtime values such as ",[15,631,32],{}," still come from the generated ",[15,634,514],{},". The common rewrites:",[637,638,639,672,688,793,809],"code-group",{},[58,640,644],{"language":641,"filename":642,"code":643,"class":62},"diff","Imports","- import type { RequestConfig } from '@kubb\u002Fplugin-fetch\u002Ftemplates\u002Ffetch.ts'\n- import type { ResolvedRequest } from '@kubb\u002Fplugin-fetch\u002Ftemplates\u002Fcore.ts'\n+ import type { RequestConfig } from '@kubb\u002Fplugin-fetch\u002Ftemplates\u002Fclient.ts'\n+ import type { ResolvedRequest } from '@kubb\u002Fplugin-client\u002Ftemplates\u002Fcore.ts'",[15,645,647,654,655,654,660,654,667],{"class":646},"language-diff",[67,648,650],{"class":649,"style":70},"line diff remove",[67,651,653],{"style":652},"color:#b31d28;--hls-dark:#fdaeb7"," import type { RequestConfig } from '@kubb\u002Fplugin-fetch\u002Ftemplates\u002Ffetch.ts'","\n",[67,656,657],{"class":649,"style":70},[67,658,659],{"style":652}," import type { ResolvedRequest } from '@kubb\u002Fplugin-fetch\u002Ftemplates\u002Fcore.ts'",[67,661,663],{"class":662,"style":70},"line diff add",[67,664,666],{"style":665},"color:#22863a;--hls-dark:#85e89d"," import type { RequestConfig } from '@kubb\u002Fplugin-fetch\u002Ftemplates\u002Fclient.ts'",[67,668,669],{"class":662,"style":70},[67,670,671],{"style":665}," import type { ResolvedRequest } from '@kubb\u002Fplugin-client\u002Ftemplates\u002Fcore.ts'",[58,673,676],{"language":641,"filename":674,"code":675,"class":62},"Transport","- transport: async () => ({ data: { id: 1 }, status: 200, statusText: 'OK', headers: new Headers(), request, response })\n+ transport: async () => Response.json({ id: 1 })",[15,677,678,654,683],{"class":646},[67,679,680],{"class":649,"style":70},[67,681,682],{"style":652}," transport: async () => ({ data: { id: 1 }, status: 200, statusText: 'OK', headers: new Headers(), request, response })",[67,684,685],{"class":662,"style":70},[67,686,687],{"style":665}," transport: async () => Response.json({ id: 1 })",[58,689,693],{"language":690,"filename":691,"code":692,"class":62},"typescript","Error interceptors","client.interceptors.error.use((error) => {\n  if (ResponseError.is(error) && error.status === 401) refreshToken()\n  return error\n})",[15,694,696,654,730,654,779,654,788],{"class":695},"language-typescript",[67,697,698,700,703,706,708,711,713,716,719,721,724,727],{"class":69,"style":70},[67,699,32],{"style":77},[67,701,26],{"style":702},"color:#d73a49;--hls-dark:#f97583",[67,704,705],{"style":94},"interceptors",[67,707,26],{"style":702},[67,709,710],{"style":94},"error",[67,712,26],{"style":702},[67,714,715],{"style":73},"use",[67,717,718],{"style":94},"((",[67,720,710],{"style":77},[67,722,723],{"style":94},") ",[67,725,726],{"style":702},"=> ",[67,728,729],{"style":94},"{",[67,731,732,735,738,741,744,746,749,751,753,755,758,760,762,765,768,771,773,776],{"class":69,"style":70},[67,733,734],{"style":94},"  ",[67,736,737],{"style":702},"if ",[67,739,740],{"style":94},"(",[67,742,743],{"style":73},"ResponseError",[67,745,26],{"style":702},[67,747,748],{"style":73},"is",[67,750,740],{"style":94},[67,752,710],{"style":77},[67,754,723],{"style":94},[67,756,757],{"style":702},"&& ",[67,759,710],{"style":77},[67,761,26],{"style":702},[67,763,764],{"style":94},"status ",[67,766,767],{"style":702},"=== ",[67,769,770],{"style":94},"401",[67,772,723],{"style":94},[67,774,775],{"style":73},"refreshToken",[67,777,778],{"style":94},"()",[67,780,781,783,786],{"class":69,"style":70},[67,782,734],{"style":94},[67,784,785],{"style":702},"return ",[67,787,710],{"style":77},[67,789,790],{"class":69,"style":70},[67,791,792],{"style":94},"})",[58,794,797],{"language":641,"filename":795,"code":796,"class":62},"Status ranges","- import type { ListPetsStatus4XX } from '.\u002Fgen\u002Ftypes\u002FListPets'\n+ import type { ListPetsStatus4xx } from '.\u002Fgen\u002Ftypes\u002FListPets'",[15,798,799,654,804],{"class":646},[67,800,801],{"class":649,"style":70},[67,802,803],{"style":652}," import type { ListPetsStatus4XX } from '.\u002Fgen\u002Ftypes\u002FListPets'",[67,805,806],{"class":662,"style":70},[67,807,808],{"style":665}," import type { ListPetsStatus4xx } from '.\u002Fgen\u002Ftypes\u002FListPets'",[58,810,813],{"language":641,"filename":811,"code":812,"class":62},"SDK classes","- import { pet } from '.\u002Fgen\u002Fsdk\u002Fpet\u002Fpet'\n- const api = new pet({ baseURL })\n+ import { PetClient } from '.\u002Fgen\u002Fsdk\u002Fpet\u002Fpet'\n+ const api = new PetClient({ baseURL })",[15,814,815,654,820,654,825,654,830],{"class":646},[67,816,817],{"class":649,"style":70},[67,818,819],{"style":652}," import { pet } from '.\u002Fgen\u002Fsdk\u002Fpet\u002Fpet'",[67,821,822],{"class":649,"style":70},[67,823,824],{"style":652}," const api = new pet({ baseURL })",[67,826,827],{"class":662,"style":70},[67,828,829],{"style":665}," import { PetClient } from '.\u002Fgen\u002Fsdk\u002Fpet\u002Fpet'",[67,831,832],{"class":662,"style":70},[67,833,834],{"style":665}," const api = new PetClient({ baseURL })",[35,836,357],{"id":837},"media-types",[11,839,840,843,844,847,848,851,852,855,856,858],{},[15,841,842],{},"serialize(body, contentType)"," becomes ",[15,845,846],{},"encode(body, context)",", with the type in ",[15,849,850],{},"context.contentType",". ",[15,853,854],{},"decode(response, context)"," gets the ",[15,857,230],{},", not a parsed body, so read the body yourself:",[58,860,862],{"language":641,"code":861,"class":62},"- client.setConfig({ codecs: { 'application\u002Fxml': { deserialize: (raw) => parseXml(raw as string) } } })\n+ client.setConfig({ mediaTypes: { 'application\u002Fxml': { decode: async (response) => parseXml(await response.text()) } } })",[15,863,864,654,869],{"class":646},[67,865,866],{"class":649,"style":70},[67,867,868],{"style":652}," client.setConfig({ codecs: { 'application\u002Fxml': { deserialize: (raw) => parseXml(raw as string) } } })",[67,870,871],{"class":662,"style":70},[67,872,873],{"style":665}," client.setConfig({ mediaTypes: { 'application\u002Fxml': { decode: async (response) => parseXml(await response.text()) } } })",[11,875,876,877,353,880,26],{},"A key can be a pattern, such as ",[15,878,879],{},"text\u002F*",[147,881,883],{"href":882},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-fetch\u002Fguides\u002Fserialization#built-in-media-types","Built-in media types",[35,885,492],{"id":886},"streams",[11,888,889,891],{},[15,890,485],{}," returns the stream directly:",[58,893,895],{"language":641,"code":894,"class":62},"- const { stream } = await toEventStream(client({ method: 'GET', url: '\u002Fevents', responseType: 'stream' }), { shape: 'data' })\n+ const { stream } = await client.stream({ method: 'GET', url: '\u002Fevents', eventShape: 'data' })",[15,896,897,654,902],{"class":646},[67,898,899],{"class":649,"style":70},[67,900,901],{"style":652}," const { stream } = await toEventStream(client({ method: 'GET', url: '\u002Fevents', responseType: 'stream' }), { shape: 'data' })",[67,903,904],{"class":662,"style":70},[67,905,906],{"style":665}," const { stream } = await client.stream({ method: 'GET', url: '\u002Fevents', eventShape: 'data' })",[11,908,909,53,911,914,915,917,918,921],{},[15,910,488],{},[15,912,913],{},"UnwrappedStreamResult"," take the responses record and the full event type, so wrap a payload in ",[15,916,499],{},". A ",[15,919,920],{},"TypedEvent\u003C…>"," stays as is:",[58,923,925],{"language":641,"code":924,"class":62},"- let result: EventStreamResult\u003CPetEvent>\n+ let result: StreamResult\u003CStreamPetsResponses, true, ServerSentEvent\u003CPetEvent>>",[15,926,927,654,932],{"class":646},[67,928,929],{"class":649,"style":70},[67,930,931],{"style":652}," let result: EventStreamResult\u003CPetEvent>",[67,933,934],{"class":662,"style":70},[67,935,936],{"style":665}," let result: StreamResult\u003CStreamPetsResponses, true, ServerSentEvent\u003CPetEvent>>",[11,938,939,940,942,943,26],{},"An operation whose only success type is JSON Lines returns a ",[15,941,488],{}," with one parsed item per line, not a string. For stream responses with headers, see ",[147,944,946],{"href":945},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-fetch\u002Fguides\u002Fserver-sent-events#stream-result-types","Stream result types",[35,948,950],{"id":949},"behavior-changes","Behavior changes",[11,952,953],{},"These compile without errors, so check them by hand:",[161,955,956,969],{},[164,957,958],{},[167,959,960,963,966],{},[170,961,962],{},"Area",[170,964,965],{},"v5",[170,967,968],{},"v6",[177,970,971,995,1019,1034,1049,1075,1095],{},[167,972,973,976,986],{},[182,974,975],{},"Requests",[182,977,978,979,982,983,26],{},"A path or operation with its own ",[15,980,981],{},"servers"," used the client's ",[15,984,985],{},"baseURL",[182,987,988,989,353,991,26],{},"It calls its own server, unless the call sets ",[15,990,985],{},[147,992,994],{"href":993},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-fetch\u002Fguides\u002Fconfigure-requests#set-the-base-url","Set the base URL",[167,996,997,999,1009],{},[182,998,975],{},[182,1000,1001,1002,1005,1006,26],{},"An object query parameter without ",[15,1003,1004],{},"style",": ",[15,1007,1008],{},"filter[name]=odie",[182,1010,1011,1014,1015,1018],{},[15,1012,1013],{},"name=odie&age=3",". Set ",[15,1016,1017],{},"style: deepObject"," in the spec to keep the brackets.",[167,1020,1021,1023,1029],{},[182,1022,975],{},[182,1024,1025,1026,1028],{},"An array or object header without ",[15,1027,1004],{}," went out as JSON.",[182,1030,1031],{},[15,1032,1033],{},"X-Ids: 3,4",[167,1035,1036,1038,1044],{},[182,1037,975],{},[182,1039,1040,1041,26],{},"A space in a query value: ",[15,1042,1043],{},"+",[182,1045,1046],{},[15,1047,1048],{},"%20",[167,1050,1051,1053,1062],{},[182,1052,975],{},[182,1054,1055,53,1058,1061],{},[15,1056,1057],{},"spaceDelimited",[15,1059,1060],{},"pipeDelimited"," repeated the key.",[182,1063,1064,1067,1068,1071,1072,26],{},[15,1065,1066],{},"explode"," defaults to ",[15,1069,1070],{},"false",", so an array goes out as ",[15,1073,1074],{},"ids=1%7C2",[167,1076,1077,1079,1085],{},[182,1078,975],{},[182,1080,217,1081,1084],{},[15,1082,1083],{},"style: cookie"," parameter was percent-encoded.",[182,1086,1087,1088,1091,1092,26],{},"Sent as is. A value it cannot send, such as one with ",[15,1089,1090],{},";",", throws a ",[15,1093,1094],{},"TypeError",[167,1096,1097,1100,1103],{},[182,1098,1099],{},"Responses",[182,1101,1102],{},"Invalid JSON under a JSON media type became a string.",[182,1104,1105,1106,1109,1110,1113],{},"Throws a ",[15,1107,1108],{},"ParseError",". Catch it, or register a lenient ",[15,1111,1112],{},"application\u002Fjson"," entry.",[11,1115,1116],{},"Also new in v6:",[1118,1119,1120,1136,1160,1167,1210,1229],"ul",{},[1121,1122,1123,1124,1127,1128,1131,1132,1135],"li",{},"Requests: ",[15,1125,1126],{},"body: null"," is sent as JSON ",[15,1129,1130],{},"null",". A stream call sends ",[15,1133,1134],{},"Accept: text\u002Fevent-stream",", or its JSON Lines media type. An auth requirement with several schemes sends all of them.",[1121,1137,1138,1139,1142,1143,1146,1147,1149,1150,1152,1153,1146,1156,1159],{},"Responses: an empty body is ",[15,1140,1141],{},"undefined"," for every media type, text included. A failed call without a body has ",[15,1144,1145],{},"{ status, statusText }"," as ",[15,1148,710],{},". Every result and thrown ",[15,1151,743],{}," has the response ",[15,1154,1155],{},"Headers",[15,1157,1158],{},"headers",". An aborted call or stream rejects with the signal's reason.",[1121,1161,1162,1163,1166],{},"Validation: ",[15,1164,1165],{},"ResponseError.data"," holds the validated body.",[1121,1168,1169,1170,1173,1174,1177,1178,1180,1181,1184,1185,1188,1189,1192,1193,1196,1197,1200,1201,851,1204,1206,1207,26],{},"Types: a ",[15,1171,1172],{},"2xx"," key is a success, a range key such as ",[15,1175,1176],{},"4xx"," types ",[15,1179,261],{}," as the codes it covers, and an exact code such as ",[15,1182,1183],{},"200"," wins over a range. XML, YAML, and CSV responses are ",[15,1186,1187],{},"string",", so JSON and XML together give ",[15,1190,1191],{},"data: Pet | string",". Image, audio, video, PDF, and ",[15,1194,1195],{},"application\u002Foctet-stream"," responses are ",[15,1198,1199],{},"Blob",", even with ",[15,1202,1203],{},"type: string",[15,1205,467],{}," is the bare media type, such as ",[15,1208,1209],{},"'text\u002Fhtml'",[1121,1211,1212,1213,1216,1217,1220,1221,1224,1225,1228],{},"Serializers: each has its own file in ",[15,1214,1215],{},".kubb\u002Fserializers\u002F",", and ",[15,1218,1219],{},"setConfig({ serializer })"," merges per key. A ",[15,1222,1223],{},"createClientCore"," client gets no serializers, so pass them in its ",[15,1226,1227],{},"serializer"," config.",[1121,1230,1231,1232,1235,1236,26],{},"Servers: ",[15,1233,1234],{},"server.index"," no longer counts a server without a ",[15,1237,1238],{},"url",[11,1240,1241,1242,26],{},"If you upgrade from 5.12 or earlier, also check ",[147,1243,1245],{"href":1244},"#from-512-or-earlier","these changes",[35,1247,1249],{"id":1248},"query-plugins","Query plugins",[11,1251,1252,200,1255,200,1258,1216,1261,1264],{},[15,1253,1254],{},"@kubb\u002Fplugin-react-query",[15,1256,1257],{},"@kubb\u002Fplugin-vue-query",[15,1259,1260],{},"@kubb\u002Fplugin-swr",[15,1262,1263],{},"@kubb\u002Fplugin-mcp"," work with v5 and v6, so you can upgrade them separately. They skip hooks for JSON Lines and event stream operations.",[35,1266,1268],{"id":1267},"less-common-cases","Less common cases",[44,1270,1272],{"id":1271},"new-in-v6","New in v6",[11,1274,1275],{},"These v6 features need no code change:",[1118,1277,1278,1287,1301],{},[1121,1279,1162,1280,1282,1283,1286],{},[15,1281,529],{}," takes a map by status, such as ",[15,1284,1285],{},"{ 404: getPetStatus404Schema }",", to check an error body against the schema of its status.",[1121,1288,1289,1290,53,1293,1296,1297,26],{},"Serializers: ",[15,1291,1292],{},"serializer.header",[15,1294,1295],{},"serializer.cookie"," are new. See ",[147,1298,1300],{"href":1299},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-fetch\u002Fguides\u002Fserialization#override-parameter-serialization","Override parameter serialization",[1121,1302,1303,1304,505,1306,353,1308,26],{},"Servers: named servers are exported as ",[15,1305,981],{},[15,1307,514],{},[147,1309,1311],{"href":1310},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-fetch\u002Fguides\u002Fconfigure-requests#named-servers","Named servers",[44,1313,1315],{"id":1314},"from-512-or-earlier","From 5.12 or earlier",[11,1317,1318],{},"These changed in 5.13 and compile without errors:",[1118,1320,1321,1331],{},[1121,1322,1323,1324,1326,1327,1330],{},"A successful stream call with a non-stream body, such as JSON, throws a ",[15,1325,1094],{}," with the body as its ",[15,1328,1329],{},"cause",". A successful answer with no body still ends as an empty stream.",[1121,1332,1333,1334,1337],{},"An event that does not end with a blank line is dropped, as in browser ",[15,1335,1336],{},"EventSource",", so end every event with one.",[44,1339,1341],{"id":1340},"sdk-root-class","SDK root class",[11,1343,1344,1345,1348,1349,26],{},"With an SDK root class, add interceptors on ",[15,1346,1347],{},"api.client",", because the root class shares one client with every tag. See ",[147,1350,1352],{"href":1351},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-fetch\u002Foptions#sdk",[15,1353,593],{},{"title":1355,"searchDepth":1356,"depth":1356,"links":1357},"",5,[1358,1366,1367,1368,1369,1370,1371],{"id":37,"depth":1359,"text":38,"children":1360},2,[1361,1363,1364,1365],{"id":46,"depth":1362,"text":47},3,{"id":98,"depth":1362,"text":99},{"id":122,"depth":1362,"text":123},{"id":141,"depth":1362,"text":142},{"id":159,"depth":1359,"text":150},{"id":837,"depth":1359,"text":357},{"id":886,"depth":1359,"text":492},{"id":949,"depth":1359,"text":950},{"id":1248,"depth":1359,"text":1249},{"id":1267,"depth":1359,"text":1268,"children":1372},[1373,1374,1375],{"id":1271,"depth":1362,"text":1272},{"id":1314,"depth":1362,"text":1315},{"id":1340,"depth":1362,"text":1341},"\u002Fextensions\u002Fkubb-labs\u002Fplugin-fetch\u002Fguides\u002Fmigrate-to-v6",1794776437849]