An open API service indexing awesome lists of open source software.

https://github.com/scalajs-io/cookie

Basic HTTP cookie parser and serializer for HTTP servers.
https://github.com/scalajs-io/cookie

cookie node nodejs npm npm-package scala scalajs

Last synced: 5 months ago
JSON representation

Basic HTTP cookie parser and serializer for HTTP servers.

Awesome Lists containing this project

README

          

Cookie API for Scala.js
================================
[cookie](https://www.npmjs.com/package/cookie) - HTTP server cookie parsing and serialization.

### Description

Basic HTTP cookie parser and serializer for HTTP servers.


### Build Requirements

* [SBT v1.2.x](http://www.scala-sbt.org/download.html)


### Build/publish the SDK locally

```bash
$ sbt clean publish-local
```

### Running the tests

Before running the tests the first time, you must ensure the npm packages are installed:

```bash
$ npm install
```

Then you can run the tests:

```bash
$ sbt test
```

### Examples

```scala
import io.scalajs.JSON
import io.scalajs.npm.cookie._

val cookies = Cookie.parse("foo=bar; equation=E%3Dmc%5E2")
println(s"cookies => ${JSON.stringify(cookies)}") //=> { "foo" : "bar", "equation" : "E=mc^2" }
```

### Artifacts and Resolvers

To add the `Cookie` binding to your project, add the following to your build.sbt:

```sbt
libraryDependencies += "io.scalajs.npm" %%% "cookie" % "0.5.0"
```

Optionally, you may add the Sonatype Repository resolver:

```sbt
resolvers += Resolver.sonatypeRepo("releases")
```