Update sdk-tweak-model.ts (#1317)
* Update sdk-tweak-model.ts For head API, the response should be 204 * Update sdk-tweak-model.ts
This commit is contained in:
Родитель
ba1766846d
Коммит
c33b901221
|
@ -324,7 +324,8 @@ async function tweakOperation(state: State) {
|
|||
respCountWithBody = schemas.size + specialBinaryResponse;
|
||||
const isHead = operation.requests && operation.requests[0].protocol.http?.method === 'head';
|
||||
if (isHead) {
|
||||
initializeResponseBody = '_result.Body = (_statusCode == System.Net.HttpStatusCode.OK);';
|
||||
const succeedCode = operation.responses.filter(r => (<string>r.protocol.http?.statusCodes[0]).startsWith('2'))[0].protocol.http?.statusCodes[0];
|
||||
initializeResponseBody = `_result.Body = (_statusCode == System.Net.HttpStatusCode.${(<any>StatusCodes)[succeedCode]});`;
|
||||
}
|
||||
const responses = operation.responses.filter(r => (<any>r).schema);
|
||||
const hasHeaderResponse = operation.responses.some(r => (<any>r).protocol.http.headers);
|
||||
|
@ -469,4 +470,4 @@ export async function tweakSdkModelPlugin(service: Host) {
|
|||
}
|
||||
throw E;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче