Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { assert, describe, it, beforeEach } from "vitest";
import { ConditionalRequestClient } from "./generated/azure/special-headers/conditional-request/src/index.js";

describe("Azure_SpecialHeaders_ConditionalRequest", () => {
let client: ConditionalRequestClient;

beforeEach(() => {
client = new ConditionalRequestClient({
endpoint: "http://localhost:3002",
allowInsecureConnection: true,
retryOptions: {
maxRetries: 0
}
});
});

it("should send the If-Match header", async () => {
await client.postIfMatch({
ifMatch: `"valid"`
});
assert.ok(true);
});

it("should send the If-None-Match header", async () => {
await client.postIfNoneMatch({
ifNoneMatch: `"invalid"`
});
assert.ok(true);
});

it("should send the custom x-ms-blob-if-match header", async () => {
await client.postCustomIfMatch({
ifMatch: `"valid"`
});
assert.ok(true);
});

it("should send the custom x-ms-blob-if-none-match header", async () => {
await client.postCustomIfNoneMatch({
ifNoneMatch: `"invalid"`
});
assert.ok(true);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
!/src
/src/**
!/src/index.d.ts
!/.gitignore
!/tspconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { ClientOptions } from '@azure-rest/core-client';
import { isRestError } from '@azure/core-rest-pipeline';
import { OperationOptions } from '@azure-rest/core-client';
import { Pipeline } from '@azure/core-rest-pipeline';
import { RestError } from '@azure/core-rest-pipeline';

export declare class ConditionalRequestClient {
private _client;
readonly pipeline: Pipeline;
constructor(options?: ConditionalRequestClientOptionalParams);
postCustomIfNoneMatch(options?: PostCustomIfNoneMatchOptionalParams): Promise<void>;
postCustomIfMatch(options?: PostCustomIfMatchOptionalParams): Promise<void>;
postIfNoneMatch(options?: PostIfNoneMatchOptionalParams): Promise<void>;
postIfMatch(options?: PostIfMatchOptionalParams): Promise<void>;
}

export declare interface ConditionalRequestClientOptionalParams extends ClientOptions {
}

export { isRestError }

export declare interface PostCustomIfMatchOptionalParams extends OperationOptions {
ifMatch?: string;
}

export declare interface PostCustomIfNoneMatchOptionalParams extends OperationOptions {
ifNoneMatch?: string;
}

export declare interface PostIfMatchOptionalParams extends OperationOptions {
ifMatch?: string;
}

export declare interface PostIfNoneMatchOptionalParams extends OperationOptions {
ifNoneMatch?: string;
}

export { RestError }

export { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
emit:
- "@azure-tools/typespec-ts"
options:
"@azure-tools/typespec-ts":
emitter-output-dir: "{project-root}"
generate-test: false
add-credentials: false
flavor: azure
azure-sdk-for-js: false
is-typespec-test: true
package-details:
name: "@msinternal/azure-special-headers-conditional-request"
description: "Azure Special Headers Conditional Request Test Service"
4 changes: 4 additions & 0 deletions packages/typespec-ts/test/commands/cadl-ranch-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,10 @@ export const azureModularTsps = [
outputPath: "azure/special-headers/client-request-id",
inputPath: "azure/special-headers/client-request-id"
},
{
outputPath: "azure/special-headers/conditional-request",
inputPath: "azure/special-headers/conditional-request"
},
{
outputPath: "parameters/collection-format",
inputPath: "parameters/collection-format"
Expand Down
Loading