func channelRead()

in FishyTransport/Sources/FishyActorTransport/FishyTransport+Server.swift [63:85]


  func channelRead(context: ChannelHandlerContext, data: NIOAny) {
    switch unwrapInboundIn(data) {
    case .head(let head):
      guard case .POST = head.method else {
        self.respond405(context: context)
        return
      }

      messageRecipientURI = head.uri
      state.requestReceived()

    case .body(var bytes):
      if (state == State.idle) { return }
      messageBytes.writeBuffer(&bytes)

    case .end:
      if (state == State.idle) { return }
      onMessageComplete(context: context, messageBytes: messageBytes)
      state.requestComplete()
      messageBytes.clear()
      messageRecipientURI = ""
    }
  }