webclient

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package webclient is a short-lived HTTP client for app.bitrise.io's Rails-Devise endpoints (signup, email/password sign-in).

Separate from internal/bitriseapi (bearer tokens against api.bitrise.io): the website uses cookie sessions plus CSRF, and the jar lives only inside one command invocation — never persisted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps an http.Client with a per-call cookie jar and CSRF priming. Construct one per command invocation; do not reuse across commands.

func New

func New(baseURL string) (*Client, error)

New builds a Client targeting baseURL, with its own cookie jar — pass one Client through a single sequence of calls (Prime → PostJSON …) and discard it.

func (*Client) PostJSON

func (c *Client) PostJSON(ctx context.Context, path string, body any) (Response, error)

PostJSON sends body as JSON to path, attaching X-CSRF-Token when Prime captured one. Any "skip CSRF" exception lives at the call site.

func (*Client) Prime

func (c *Client) Prime(ctx context.Context, path string) error

Prime issues a GET to an HTML path (e.g. "/users/sign_up"), captures cookies, and extracts the CSRF token for subsequent PostJSON calls.

type Response

type Response struct {
	Status int
	Body   []byte
}

Response carries the status code and body of a website request.

Jump to

Keyboard shortcuts

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