function peekRequest
peekRequest(
httpService: HttpService,
verb: string | null,
url: string,
pageUrl?: string | null
): HttpRequest | null

The most recent request a [verb:]url means, or null where the session never made one.

Newest first, because "the request to /api/users" means the last one when a session has made six. An empty url means the last request of all, which is what a bare .request asks for.

Matching is exact-then-forgiving: the fully resolved URL if that is what was typed, otherwise any request whose URL CONTAINS the text. .request /api/users should find http://localhost:4321/api/users?page=2 without anybody having to paste the query string back in, and .request users should find it too.

import { peekRequest, create } from './http-service.ts';

peekRequest(create(), null, ''); // null — nothing has been sent

Parameters

httpService: HttpService
verb: string | null
url: string
optional
pageUrl: string | null = null

Return Type

HttpRequest | null

Usage

import { peekRequest } from "lib/repl/http-service.ts";