package com.eactive.httpmockserver.api.condition;

import com.eactive.httpmockserver.api.dto.MockRequest;
import com.eactive.httpmockserver.api.entity.MockCondition;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class HeaderMatcher implements ConditionMatcher {
    @Override
    public boolean matches(MockCondition condition, MockRequest request, Map<String, String> pathVariables) {
        return condition.getValue().equals(request.getHeader(condition.getKey()));
    }

    @Override
    public String getType() {
        return "header";
    }

    @Override
    public String getDisplayName() {
        return "Header";
    }
}
