> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate the response

> Validate the response headers and body based on a set criteria.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Validate the response headers and body based on a set criteria. Add this to a connection when you want to be sure the other system actually answered the way you expect, not just that it answered. Each time a response comes back, this plugin runs it through the checks you choose. If every check passes, the response continues on as normal; if any check fails, the request is treated as failed and the connection raises an error instead of letting bad data through. Use it to catch things like a missing header or a body that does not contain what it should.

This documentation describes: [Schema](/schemas/http-client-plugin-configurator/response-validator)

## Fields

<FormField property="validators" label="Validations" diType="http-response-validator">
  The checks to run against each response. Add one or more response validators here, such as a check on a required header or on the contents of the body. A response has to satisfy every validator you list before it is accepted; if any one of them fails, the request fails. Leave the list empty to apply no checks.
</FormField>

## Sample data

This plugin does not change the response. It only inspects it and either lets it through or fails the request, so there is no before/after to show. A typical setup lists one or more response validators that confirm the response looks the way you expect.

For example, a connection that should only accept responses carrying the expected body and header might list a body check and a header check together. Both must pass for the response to be accepted.

| Field       | Value                                           |
| ----------- | ----------------------------------------------- |
| Validations | A body validator plus a header-exists validator |

```json Configuration theme={null}
{
  "prototype": "response-validator",
  "parameters": {
    "validators": [
      {
        "prototype": "body",
        "parameters": {}
      },
      {
        "prototype": "header-exists",
        "parameters": {}
      }
    ]
  }
}
```
