# System.Net.Http.Primitives

**Kind:** Service

**Source:** `Pams/Logic/Pams.Storage/Pams.Storage.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`System.Net.Http.Primitives` is a NuGet package dependency declared by `Pams.Storage`. It supplies HTTP request, response, header, and related primitive types used when storage code exchanges data with HTTP-based services.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Storage as Pams.Storage
    participant Http as System.Net.Http.Primitives
    participant Service as HTTP Service

    Client->>Storage: Request storage operation
    Storage->>Http: Create HTTP request and headers
    Http->>Service: Send HTTP message
    Service-->>Http: Return HTTP response
    Http-->>Storage: Expose response primitives
    Storage-->>Client: Return operation result
```

## Usage

```ts
async function getStorageRecord(recordId: string) {
  const response = await fetch(`/api/storage/${encodeURIComponent(recordId)}`, {
    headers: {
      Accept: "application/json",
    },
  });

  if (!response.ok) {
    throw new Error(`Storage request failed: ${response.status}`);
  }

  return response.json();
}

const record = await getStorageRecord("record-id");
console.log(record);
```

## AI Coding Instructions

- Treat `System.Net.Http.Primitives` as a dependency used by the .NET `Pams.Storage` project, not as a JavaScript package.
- Keep HTTP request construction, headers, and response handling inside the storage integration layer.
- Check HTTP response status before reading response content.
- Preserve package compatibility with the legacy project format in `Pams.Storage.csproj`.

## Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (2)

- `Pams.Email` — `Pams/Logic/Pams.Email/Pams.Email.csproj`:1
- `Pams.Storage` — `Pams/Logic/Pams.Storage/Pams.Storage.csproj`:1
