Question: Here is a part of my code I am trying 

```
const boom = require('boom')
exports.checkOtp = async (req, reply) => {
    try {
        return boom.badRequest('no active otp')
    } catch (err) {
        throw boom.boomify(err)
    }
}

```

I am getting 

```
{
  "statusCode": 500,
  "error": "Internal Server Error",
  "message": "no active otp"
}

```

`boom.badRequest` should fire a `400` right?

Answer: 
In .NET Core there is an overload of [Contains](https://learn.microsoft.com/en-us/dotnet/api/system.string.contains?view=netcore-2.1) which allows specifying comparison rules. There you could end up with something like:

```
public static class ExpressionRetriever
{
    private static MethodInfo containsMethod = typeof(string).GetMethod("Contains", new Type[] { typeof(string), typeof(StringComparison)});
    ...

    public static Expression GetExpression<T>(ParameterExpression param, ExpressionFilter filter)
    {
        ...
        ConstantExpression comparisonType = Expression.Constant(StringComparison.OrdinalIgnoreCase);
        switch (filter.Comparison)
        {
            ...
            case Comparison.Contains:
                return Expression.Call(member, containsMethod, constant), comparisonType);
        }
    }
}

```

In any other case, you could create a custom compare method which you use in your expression, like:

```
public class StringExtensions
{
    public static bool ContainsIgnoringCase(string str, string substring)
    {
        return str.IndexOf(substring, StringComparison.OrdinalIgnoreCase) >= 0;
    }
}

...

public static class ExpressionRetriever
{
    ...
    private static MethodInfo containsIgnoringCaseMethod = typeof(StringExtensions).GetMethod("ContainsIgnoringCase", new Type[] { typeof(string), typeof(string)});

    public static Expression GetExpression<T>(ParameterExpression param, ExpressionFilter filter)
    {
        ...
        switch (filter.Comparison)
        {
            ...
            case Comparison.Contains:
                return Expression.Call(null, containsIgnoringCaseMethod, member, constant);
        }
    }
}

```
From the documentation for `IndexOf`, the method returns:

> 
> The index position of the value parameter if that string is found, or -1 if it is not.
> 
> 
> 

So in order to check if `Foo.PropertyName` contains `Value`, you need to create the following expression:

```
Foo.PropertyName.IndexOf(Value, StringComparison.InvariantCultureIgnoreCase) != -1

```

This means wrapping all of what you have so far in `Expression.NotEqual(left, right)`:

```
case Comparison.IndexOf:
    return Expression.NotEqual(
        Expression.Call(
            member,
            "IndexOf",
            null,
            Expression.Constant(filter.Value, typeof(string)),
            Expression.Constant(StringComparison.InvariantCultureIgnoreCase, typeof(StringComparison))
        ),
        Expression.Constant(-1, typeof(int))
    );

```