1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-23 12:57:05 +00:00

add a README note about the known issues for Go inside code editors/IDEs

Former-commit-id: a4be78e746f5675291bab5a1b3e62eaf42cbd98c
This commit is contained in:
Gerasimos (Makis) Maropoulos
2018-08-02 01:58:46 +03:00
parent 2b72aadb15
commit d98da25ffb
3 changed files with 27 additions and 3 deletions

View File

@@ -10,7 +10,12 @@ import (
"time"
"github.com/kataras/golog"
"github.com/kataras/iris"
// Note:
// For some reason the latest vscode-go language extension does not provide enough intelligence (parameters documentation and go to definition features)
// for the `iris.Context` alias, therefore if you use VS Code, import the original import path of the `Context`, that will do it:
"github.com/kataras/iris/context"
)
// A Broker holds open client connections,
@@ -73,7 +78,7 @@ func (b *Broker) listen() {
}
}
func (b *Broker) ServeHTTP(ctx iris.Context) {
func (b *Broker) ServeHTTP(ctx context.Context) {
// Make sure that the writer supports flushing.
//
flusher, ok := ctx.ResponseWriter().(http.Flusher)
@@ -84,7 +89,7 @@ func (b *Broker) ServeHTTP(ctx iris.Context) {
}
// Set the headers related to event streaming, you can omit the "application/json" if you send plain text.
// If you developer a go client, you must have: "Accept" : "application/json, text/event-stream" header as well.
// If you develop a go client, you must have: "Accept" : "application/json, text/event-stream" header as well.
ctx.ContentType("application/json, text/event-stream")
ctx.Header("Cache-Control", "no-cache")
ctx.Header("Connection", "keep-alive")