---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [safety](../index.md) / checkSafetyViolation

# ~~Function: checkSafetyViolation()~~

> **checkSafetyViolation**(`method`, `url`, `config`): `string` \| `undefined`

Defined in: [packages/b2c-tooling-sdk/src/safety/safety-middleware.ts:160](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/safety/safety-middleware.ts#L160)

Checks if an HTTP operation should be blocked based on safety configuration.

## Parameters

### method

`string`

HTTP method (GET, POST, PUT, PATCH, DELETE)

### url

`string`

Request URL

### config

[`SafetyConfig`](../interfaces/SafetyConfig.md)

Safety configuration

## Returns

`string` \| `undefined`

Error message if blocked, undefined if allowed

## Deprecated

Use [SafetyGuard.evaluate](../classes/SafetyGuard.md#evaluate) for full rule-based evaluation.
