| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/server.R |
| 3 |
\name{handler_inline} |
| 4 |
\alias{handler_inline} |
| 5 |
\title{Create Inline Static Content Handler} |
| 6 |
\usage{ |
| 7 |
handler_inline(path, data, content_type = NULL, prefix = FALSE) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{path}{URI path to match (e.g., "/robots.txt").} |
| 11 |
|
| 12 |
\item{data}{Content to serve. Character data is converted to raw bytes.} |
| 13 |
|
| 14 |
\item{content_type}{MIME type (e.g., "text/plain", "application/json"). |
| 15 |
Defaults to "application/octet-stream" if NULL.} |
| 16 |
|
| 17 |
\item{prefix}{[default FALSE] Logical, if TRUE matches path as a prefix.} |
| 18 |
} |
| 19 |
\value{ |
| 20 |
A handler object for use with \code{\link[=http_server]{http_server()}}. |
| 21 |
} |
| 22 |
\description{ |
| 23 |
Creates an HTTP handler that serves in-memory static content. Useful for |
| 24 |
small files like robots.txt or inline JSON/HTML. |
| 25 |
} |
| 26 |
\examples{ |
| 27 |
h1 <- handler_inline("/robots.txt", "User-agent: *\nDisallow:", |
| 28 |
content_type = "text/plain") |
| 29 |
h2 <- handler_inline("/health", '{"status":"ok"}', |
| 30 |
content_type = "application/json") |
| 31 |
|
| 32 |
} |