浏览代码

api: server: container: fix wrong comment

This comment was wrongly referring to the old job mechanism and it
wasn't clear what it was trying to document.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
Antonio Murdaca 9 年之前
父节点
当前提交
76b3b54314
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      api/server/container.go

+ 5 - 1
api/server/container.go

@@ -94,7 +94,11 @@ func (s *Server) getContainersLogs(ctx context.Context, w http.ResponseWriter, r
 		return fmt.Errorf("Missing parameter")
 	}
 
-	// Validate args here, because we can't return not StatusOK after job.Run() call
+	// Args are validated before the stream starts because when it starts we're
+	// sending HTTP 200 by writing an empty chunk of data to tell the client that
+	// daemon is going to stream. By sending this initial HTTP 200 we can't report
+	// any error after the stream starts (i.e. container not found, wrong parameters)
+	// with the appropriate status code.
 	stdout, stderr := boolValue(r, "stdout"), boolValue(r, "stderr")
 	if !(stdout || stderr) {
 		return fmt.Errorf("Bad parameters: you must choose at least one stream")