Skip to content

Commit

Permalink
Negative values support for TextCodec and SegmentCodec (#2393)
Browse files Browse the repository at this point in the history
  • Loading branch information
danieletorelli authored Aug 24, 2023
1 parent eea2a6b commit ca6513f
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 218 deletions.
2 changes: 2 additions & 0 deletions zio-http/src/main/scala/zio/http/codec/SegmentCodec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ object SegmentCodec {
val SegmentCodec = segments(index)
var i = 0
var defined = true
if (SegmentCodec.length > 1 && SegmentCodec.charAt(0) == '-') i += 1
while (i < SegmentCodec.length) {
if (!SegmentCodec.charAt(i).isDigit) {
defined = false
Expand All @@ -170,6 +171,7 @@ object SegmentCodec {
val SegmentCodec = segments(index)
var i = 0
var defined = true
if (SegmentCodec.length > 1 && SegmentCodec.charAt(0) == '-') i += 1
while (i < SegmentCodec.length) {
if (!SegmentCodec.charAt(i).isDigit) {
defined = false
Expand Down
2 changes: 2 additions & 0 deletions zio-http/src/main/scala/zio/http/codec/TextCodec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ object TextCodec {
def isDefinedAt(value: String): Boolean = {
var i = 0
var defined = true
if (value.length > 1 && value.charAt(0) == '-') i += 1
while (i < value.length) {
if (!value.charAt(i).isDigit) {
defined = false
Expand All @@ -117,6 +118,7 @@ object TextCodec {
def isDefinedAt(value: String): Boolean = {
var i = 0
var defined = true
if (value.length > 1 && value.charAt(0) == '-') i += 1
while (i < value.length) {
if (!value.charAt(i).isDigit) {
defined = false
Expand Down
Loading

0 comments on commit ca6513f

Please sign in to comment.