You can deconstruct the data structure on your own like this:

val tag = EntityTag("kappa", weak = true)
val ifNoneMatch = `If-None-Match`(tag)

ifNoneMatch.m match {
  case EntityTagRange.Default(tags) if tags.nonEmpty ⇒ tags.head.tag
  case EntityTagRange.Default(tags) ⇒ ""
  case EntityTagRange.`*` ⇒ ""
}


ifNoneMatch match {
  case `If-None-Match`(EntityTagRange.Default(tags)) if tags.nonEmpty
⇒ tags.head.tag
  case `If-None-Match`(EntityTagRange.Default(tags)) ⇒ ""
  case `If-None-Match`(EntityTagRange.`*`) ⇒ ""
}


Happy hakking
-- 
Cheers,
Konrad 'ktoso <http://kto.so>' Malawski
Akka <http://akka.io/> @ Lightbend <http://lightbend.com/>

On January 9, 2018 at 2:04:33, Colin Bester (bester.co...@gmail.com) wrote:

On server side using scala, akka-http (10.x) I am using
*optionalHeaderValueByType[`If-None-Match`]()
{ reqETag => ... }* to extract `If-None-Match` header where reqETag is of
type *Option[If-None-Match].*

On client side, the If-None-Match is created using

  val entityTag = EntityTag(SomeSecurishString, weak = true)
  val ifNone = `If-None-Match`(entityTag)

On the server side I am looking to extract SomeSecureString, ie. the tag
value minus the prepended W/. I realize this can be done by
parsing/splitting value string but this feels real cumbersome and was
expecting an unapply function to come to the rescue.


*`If-None-Match`.unapply* returns EntityTagRange which doesn't help me much.

Any suggestions on how to extract the EntityTag's tag string from
`If-None-Match`

Much appreciated
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups
"Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to