lasp / hapi-server

A HAPI server built on LaTiS
Apache License 2.0
1 stars 1 forks source link

CSV parameter decoder issues #40

Closed lindholc closed 6 years ago

lindholc commented 6 years ago

The CSV parameter decoder misbehaves on certain inputs:

  1. Given only empty fields

    scala> csvDecoder[String].decode(QueryParameterValue(","))
    java.util.NoSuchElementException: None.get
      at scala.None$.get(Option.scala:349)
      at scala.None$.get(Option.scala:347)
      at lasp.hapi.service.QueryDecoders$$anon$1.decode(QueryDecoders.scala:33)
      ... 36 elided
  2. Given empty fields mixed with values

    scala> csvDecoder[String].decode(QueryParameterValue(",a,,,b,,"))
    res9: cats.data.ValidatedNel[org.http4s.ParseFailure,cats.data.NonEmptyList[String]] = Valid(NonEmptyList(, a, , , b))

Both should yield parse failures.