@loopback/docs
Version:
Documentation for LoopBack 4
35 lines (22 loc) • 1.07 kB
Markdown
lang: en
title: 'API docs: openapi-spec-builder.operationspecbuilder.withresponse'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.openapi-spec-builder.operationspecbuilder.withresponse.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/openapi-spec-builder](./openapi-spec-builder.md) > [OperationSpecBuilder](./openapi-spec-builder.operationspecbuilder.md) > [withResponse](./openapi-spec-builder.operationspecbuilder.withresponse.md)
## OperationSpecBuilder.withResponse() method
Describe a response for a given HTTP status code.
<b>Signature:</b>
```typescript
withResponse(status: number | 'default', responseSpec: ResponseObject): this;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| status | <code>number | 'default'</code> | HTTP status code or string "default" |
| responseSpec | <code>ResponseObject</code> | Specification of the response |
<b>Returns:</b>
`this`