diff --git a/starlette/responses.py b/starlette/responses.py
index <HASH>..<HASH> 100644
--- a/starlette/responses.py
+++ b/starlette/responses.py
@@ -107,7 +107,7 @@ class Response:
             cookie[key]["secure"] = True  # type: ignore
         if httponly:
             cookie[key]["httponly"] = True  # type: ignore
-        cookie_val = cookie.output(header="")
+        cookie_val = cookie.output(header="").strip()
         self.raw_headers.append((b"set-cookie", cookie_val.encode("latin-1")))
 
     def delete_cookie(self, key: str, path: str = "/", domain: str = None) -> None:
fixed issue <I>,trailing spaces not allowed in header (#<I>)