Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Nov 18 15:35
    nachocodexx starred Spinoco/fs2-http
  • Oct 04 01:36
    AesaKamar starred Spinoco/fs2-http
  • Jul 28 13:21
    pmukhin commented #44
  • Jun 25 07:21
    bellatoris starred Spinoco/fs2-http
  • May 11 14:59
    mfirry commented #43
  • May 05 18:37
    FXHibon starred Spinoco/fs2-http
  • May 03 08:19
    AdamChlupacek synchronize #44
  • May 03 08:19

    AdamChlupacek on upgrade-to-fs2.3

    Address review comments, remove… (compare)

  • May 02 18:40
    AdamChlupacek synchronize #44
  • May 02 18:40

    AdamChlupacek on upgrade-to-fs2.3

    Fix travis dependencies. (compare)

  • May 02 18:35

    AdamChlupacek on 0.5

    Fix travis dependencies. (compare)

  • May 02 18:33
    AdamChlupacek review_requested #44
  • May 02 18:33
    AdamChlupacek review_requested #44
  • May 02 18:33
    AdamChlupacek opened #44
  • May 02 18:27

    AdamChlupacek on upgrade-to-fs2.3

    Setting version to 0.4.0-SNAPSH… Updated to fs2 1.0.0 final Fixes #29 and 16 more (compare)

  • May 02 18:14

    AdamChlupacek on 0.5

    Merge branch 'series/0.4' of gi… (compare)

  • May 02 18:09

    AdamChlupacek on upgrade-to-fs2.3

    Migrate fs2-http to fs2 2.3.0 +… (compare)

  • Apr 23 07:28
    nebtrx starred Spinoco/fs2-http
  • Apr 10 12:43
    mfirry opened #43
  • Apr 10 12:31
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab Currently there is no way to do that, it should not be hard to extend the frames so that once of the frames in the websocket pipe will be close, and afterwards everything will clean up.
Soren
@srnb_gitlab
@AdamChlupacek BasicHttpCredentials is not enough
I need straight up plaintext
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab could you please provide how the header should look like? I am not entirely sure what you mean by plain text
Soren
@srnb_gitlab
s"Authorization: ${mpPlaintextCredentials.text}" @AdamChlupacek
case class PlaintextCredentials(text: String)
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab such format is sadly not RFC compliant according to https://tools.ietf.org/html/rfc7235#section-4.2, however you coud use our HttpCredentials.DigestHttpCredentials header in form of DigestHttpCredentials(mpPlaintextCredentials.text, Map.empty) this should be encoded into the form you require.
Soren
@srnb_gitlab
@AdamChlupacek Ah, but that gives an error that it's not an instance of OAuthCredentials
Adam Chlupacek
@AdamChlupacek
OAuthCredentials? That does not seem to be a concept in fs2-http? is that response that you get from the server where you are trying to connect?
@srnb_gitlab actually, what version of protocols are you using currently?
Soren
@srnb_gitlab
@AdamChlupacek What do you mean?
But that forces me to put Bot before the thing
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab well basically, fs2-http is dependent on spinoco/protocols where are all headers defined, it is possible that in your version of protocols the authorisation header does not yet support the multiple types of authorisation, thats why I was asking on what version of protocols are you. Anyhow in this encoding i think if you put your token instead od the bot, and left the field where you have the token now as empty string, it should be fine
Soren
@srnb_gitlab
@AdamChlupacek Nope. Then it throws an error about a trailing space.
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab thats weird, i am quite sure that we do not do these checks
I am also confused with the previous error as I could not find the “OAuthCredentials” error anywhere in the code
Soren
@srnb_gitlab
OAuthToken, not OAuthCredentials
It's in the same file as the other credentials
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab yeah, you seem to be using some outdated versions, could you please ensure that you are using "com.spinoco" %% "protocol-http" % "0.3.17" atleast, or "0.3.18-SNAPSHOT" for the newest one. Also please use the up to date fs2-http "0.4.1"
Soren
@srnb_gitlab
image.png
@AdamChlupacek
Should I require protocol-http explicitly?
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab yes you should, protocols have different release cycle compared to fs2-http
Soren
@srnb_gitlab
Alright. I'll put in a reminder to do so.
Soren
@srnb_gitlab
image.png
@AdamChlupacek
val catsCoreVersion = "2.0.0-M1"
val catsEffectVersion = "2.0.0-M1"
val fs2CoreVersion = "1.0.4"
val fs2HttpVersion = "0.4.1"
val protocolHttpVersion = "0.3.17"
val circeVersion = "0.12.0-M1"
val circeFs2Version = "0.11.0"
val spireVersion = "0.16.1"

lazy val discocat = (project in file(".")).settings (
  organization := "org.discordscala",
  name := "discocat",
  version := "0.1.0",
  scalaVersion := "2.12.8",
  libraryDependencies ++= Seq(
    "org.typelevel" %% "cats-core" % catsCoreVersion,
    "org.typelevel" %% "cats-effect" % catsEffectVersion,
    "co.fs2" %% "fs2-core" % fs2CoreVersion,
    "com.spinoco" %% "fs2-http" % fs2HttpVersion,
    "com.spinoco" %% "protocol-http" % protocolHttpVersion,
    "io.circe" %% "circe-core" % circeVersion,
    "io.circe" %% "circe-generic" % circeVersion,
    "io.circe" %% "circe-generic-extras" % circeVersion,
    "io.circe" %% "circe-parser" % circeVersion,
    "io.circe" %% "circe-fs2" % circeFs2Version,
    "org.typelevel" %% "spire" % spireVersion,
  ),
  scalacOptions ++= Seq(
    "-unchecked",
    "-deprecation",
    "-feature",
    "-Ypartial-unification",
    "-language:higherKinds",
  ),
  addCompilerPlugin(
    "org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full
  ),
)
I do have the latest protocol-http on maven
image.png
Adam Chlupacek
@AdamChlupacek
Hmm interesting, maybe i misslooked when checking, how it is being serialised. Since your header is not following the RFC, you may have to define your own header, but i find it weird that discord would require non standard headers
Soren
@srnb_gitlab
@AdamChlupacek I can't define my own header because it's a sealed trait
Adam Chlupacek
@AdamChlupacek
you can override the default serialisation of the authorisation header as shown in the example
Soren
@srnb_gitlab
GenericHeader seems to have done it
Adam Chlupacek
@AdamChlupacek
Good, that is a good quick fix if you are only needing client side of things to work.
Soren
@srnb_gitlab
java.lang.ClassCastException: spinoco.protocol.http.header.GenericHeader cannot be cast to spinoco.protocol.http.header.Authorization
    at scodec.Codec$$anon$2.encode(Codec.scala:200)
    at scodec.Codec$$anon$7.encode(Codec.scala:400)
    at scodec.EncoderFunctions.$anonfun$encodeBoth$1(Encoder.scala:111)
    at scodec.Attempt$Successful.flatMap(Attempt.scala:94)
    at scodec.EncoderFunctions.encodeBoth(Encoder.scala:110)
    at scodec.EncoderFunctions.encodeBoth$(Encoder.scala:109)
    at scodec.Codec$.encodeBoth(Codec.scala:460)
    at scodec.codecs.TupleCodec.encode(TupleCodec.scala:12)
    at scodec.codecs.TupleCodec.encode(TupleCodec.scala:6)
    at scodec.Codec$$anon$2.encode(Codec.scala:200)
    at scodec.EncoderFunctions.$anonfun$encodeBoth$1(Encoder.scala:111)
    at scodec.Attempt$Successful.flatMap(Attempt.scala:94)
    at scodec.EncoderFunctions.encodeBoth(Encoder.scala:110)
    at scodec.EncoderFunctions.encodeBoth$(Encoder.scala:109)
    at scodec.Codec$.encodeBoth(Codec.scala:460)
    at scodec.Codec$$anon$3.encode(Codec.scala:303)
    at scodec.Codec$$anon$3.encode(Codec.scala:301)
    at scodec.Codec$$anon$2.encode(Codec.scala:200)
    at scodec.Codec$$anon$7.encode(Codec.scala:400)
    at spinoco.protocol.http.codec.helper$.go$2(helper.scala:162)
    at spinoco.protocol.http.codec.helper$.$anonfun$parametrizedN$1(helper.scala:168)
    at scodec.Attempt$Successful.flatMap(Attempt.scala:94)
GenericHeader did not do it
Adam Chlupacek
@AdamChlupacek
Oh yeah, actually that is right, as "Authorization" header is registered as one of the known headers, it will try to encode it as such. You need to define your own header, and create your own HttpHeader codec using the HttpHeaderCodec.codec, so that you can actually override the default coded for the header.
Soren
@srnb_gitlab
:weary: case class TokenHeader(token: String) should work right
Adam Chlupacek
@AdamChlupacek
Yeah, that should be fine, if you follow the docs
You can actually just use the generic, if you set that authorisation gets a codec for a generic header it is one of the exaplmes in the doc
Soren
@srnb_gitlab
Yeah, everything is working now
Adam Chlupacek
@AdamChlupacek
Good, thats great
Sait Sami Kocataş
@Deliganli

hi everyone,

I am trying to transform the stream response to an effect response like below

httpClient.request(request).compile.lastOrError

I am trying to keep the http responses as effect if possible. I want to use fs2-http for websocket as well, that's why even though in some places i need to lift it to stream it makes more sense to me to keep it as effect first. But when I do that I am having the exception below on any http request.

 java.nio.channels.ClosedChannelException: null                                                              
         at java.base/sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:234)  
         at java.base/sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:298)  
         at fs2.io.tcp.Socket$.$anonfun$apply$3(Socket.scala:283)                                            
         at fs2.io.tcp.Socket$.$anonfun$apply$3$adapted(Socket.scala:276)

maybe it is not intended to evaluate that way, is it possible to use this way?

Soren
@srnb_gitlab
That's FS2-IO's socket
I have that same problem with FS2's sockets
You want to ask here
Sait Sami Kocataş
@Deliganli
thanks, I am moving it now
Seth Lasky
@TheMover
Hey guys, how can I send an SSL cert along with a request?
Seth Lasky
@TheMover
Also(sorry for rapid fire questions) is there a good way to post multipart data?