Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tags to RequestMetadata #189

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions core/src/main/scala/sttp/model/RequestMetadata.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import scala.collection.immutable.Seq
trait RequestMetadata extends HasHeaders {
def method: Method
def uri: Uri
def tags: Map[String, Any]

override def toString: String = s"RequestMetadata($method,$uri,${Headers.toStringSafe(headers)})"
override def toString: String = s"RequestMetadata($method,$uri,${Headers.toStringSafe(headers)},$tags)"
}

object RequestMetadata {
def apply(_method: Method, _uri: Uri, _headers: Seq[Header]): RequestMetadata =
def apply(_method: Method, _uri: Uri, _headers: Seq[Header], _tags: Map[String, Any] = Map.empty): RequestMetadata =
new RequestMetadata {
override def method: Method = _method
override def uri: Uri = _uri
override def tags: Map[String, Any] = _tags
override def headers: Seq[Header] = _headers
}
}