package module
Version: v1.0.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0


Joe Bot - HTTP Server

Providing HTTP integrations for Joe.

This repository contains a module for the Joe Bot library.

Getting Started

This library is packaged as Go module. You can get it via:

go get

Example usage

In order to let your bot listen to HTTP requests you should pass the http.Server(…) module when creating a new bot:

package main

import (

func main() {
	b := joe.New("example-bot",
	err := b.Run()
	if err != nil {

When the server receives a request, it will emit it to the bots brain as joehttp.RequestEvent.

Built With

  • zap - Blazing fast, structured, leveled logging in Go
  • testify - A simple unit test library


If you want to hack on this repository, please read the short guide first.


We use SemVer for versioning. For the versions available, see the tags on this repository.


  • Friedrich Große - Initial work - fgrosse

See also the list of contributors who participated in this project.


This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.



Package joehttp contains an HTTP server integrations for the Joe bot library



This section is empty.


This section is empty.


func Server

func Server(path string, opts ...Option) joe.Module

Server returns a joe Module that runs an HTTP server to receive HTTP requests and emit them as events. This Module is mainly meant to be used to integrate a Bot with other systems that send events via HTTP (e.g. pull requests on GitHub).


type Option added in v0.4.0

type Option func(*config) error

An Option is used to configure the HTTP server.

func WithLogger added in v0.4.0

func WithLogger(logger *zap.Logger) Option

WithLogger can be used to inject a different logger for the HTTP server.

func WithReadTimeout added in v0.4.0

func WithReadTimeout(d time.Duration) Option

WithReadTimeout sets the servers maximum duration for reading the entire HTTP request, including the body.

func WithTLS added in v0.4.0

func WithTLS(certFile, keyFile string) Option

WithTLS enables serving HTTP requests via TLS.

func WithTLSConfig added in v0.4.0

func WithTLSConfig(tlsConf *tls.Config) Option

WithTLSConfig can be used in combination with the WithTLS(…) option to configure the HTTPS server.

func WithTimeouts added in v0.4.0

func WithTimeouts(d time.Duration) Option

WithTimeouts sets both the read and write timeout of the HTTP server to the same given value.

func WithTrustedHeader added in v0.5.0

func WithTrustedHeader(header string) Option

WithTrustedHeader sets the name of the header from which client IPs will be populated.

func WithWriteTimeout added in v0.4.0

func WithWriteTimeout(d time.Duration) Option

WithWriteTimeout sets the servers maximum duration before timing out writes of the HTTP response.

type RequestEvent

type RequestEvent struct {
	Header     http.Header
	Method     string
	URL        *url.URL
	RemoteAddr string
	Body       []byte

RequestEvent corresponds to an HTTP request that was received by the server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL