响应标头设置不适用于错误情况

ctx.Response.Header.Set function is not working for the error case.

Please check the below code,

package main

import "fmt"
import "github.com/valyala/fasthttp"

func main() {
    requestHandler := func(ctx *fasthttp.RequestCtx) {
        ctx.Response.Header.Set("Access-Control-Allow-Origin", "*")
        switch string(ctx.Path()) {
        case "/foo":
            fmt.Fprintf(ctx, "Success result")
        case "/bar":
            ctx.Error("Unsupported path", fasthttp.StatusNotFound)
        }
    }
    fasthttp.ListenAndServe(":8080", requestHandler)
}

The /foo URL's response header is,

Server: fasthttp Date: Mon, 16 Apr 2018 04:05:10 GMT

Content-Type: text/plain; charset=utf-8

Content-Length: 14

Access-Control-Allow-Origin: *

But, the /bar 's response header is,

Server: fasthttp

Date: Mon, 16 Apr 2018 04:05:50 GMT

Content-Type: text/plain; charset=utf-8

Content-Length: 16

Access-Control-Allow-Origin header is not applied. Is anything I missed here?