summaryrefslogtreecommitdiffstats
path: root/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/filter/ResponseHeaderFilter.java
blob: 181298ea0e3d817af9a6b7c515e91f4044489f04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.filter;

import com.yahoo.jdisc.AbstractResource;
import com.yahoo.jdisc.Request;
import com.yahoo.jdisc.Response;

/**
 * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
 */
public class ResponseHeaderFilter extends AbstractResource implements ResponseFilter {

    private final String key;
    private final String val;

    public ResponseHeaderFilter(String key, String val) {
        this.key = key;
        this.val = val;
    }

    @Override
    public void filter(Response response, Request request) {
        response.headers().add(key, val);
    }
}