Skip to content

Support the more flattened HTTP response, supporting nsq v1+#35

Open
abourget wants to merge 1 commit into
segmentio:masterfrom
abourget:fix/flattened-http-protocol
Open

Support the more flattened HTTP response, supporting nsq v1+#35
abourget wants to merge 1 commit into
segmentio:masterfrom
abourget:fix/flattened-http-protocol

Conversation

@abourget
Copy link
Copy Markdown

I noticed in handler.go:

	v1 := req.Header.Get("Accept") == "application/vnd.nsq; version=1.0"

	if !v1 {
		value = struct {
			StatusCode int         `json:"status_code"`
			StatusText string      `json:"status_txt"`
			Data       interface{} `json:"data"`
		}{
			StatusCode: status,
			StatusText: text,
			Data:       value,
		}
	}

We could also do something similar here to support both versions.. a bit more refactoring would need to happen through, to bubble up the headers alongside the ret, or the ret could be a channel of more structured objects, like the LookupResult itself..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant