summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--changelog.md3
-rw-r--r--lib/pure/httpcore.nim9
2 files changed, 11 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index fa753e7c4..60e5988f1 100644
--- a/changelog.md
+++ b/changelog.md
@@ -35,6 +35,9 @@
   `parse("2020", "YYYY", utc())` is now `2020-01-01T00:00:00Z` instead of
   `2020-03-02T00:00:00Z` if run on 03-02; it also doesn't crash anymore when
   used on 29th, 30th, 31st of each month.
+- `httpcore.==(string, HttpCode)` is now deprecated due to lack of practical
+  usage. The `$` operator can be used to obtain the string form of `HttpCode`
+  for comparison if desired.
 
 ### Breaking changes in the compiler
 
diff --git a/lib/pure/httpcore.nim b/lib/pure/httpcore.nim
index 8c679c017..8916aa17d 100644
--- a/lib/pure/httpcore.nim
+++ b/lib/pure/httpcore.nim
@@ -290,7 +290,14 @@ proc `$`*(code: HttpCode): string =
 
 proc `==`*(a, b: HttpCode): bool {.borrow.}
 
-proc `==`*(rawCode: string, code: HttpCode): bool =
+proc `==`*(rawCode: string, code: HttpCode): bool
+          {.deprecated: "Deprecated since v1.2; use rawCode == $code instead".} =
+  ## Compare the string form of the status code with a HttpCode
+  ##
+  ## **Note**: According to HTTP/1.1 specification, the reason phrase is
+  ##           optional and should be ignored by the client, making this
+  ##           proc only suitable for comparing the ``HttpCode`` against the
+  ##           string form of itself.
   return cmpIgnoreCase(rawCode, $code) == 0
 
 proc is2xx*(code: HttpCode): bool =