apity
apity copied to clipboard
Support application/x-www-form-urlencoded post body (form data)
Currently the library is built for JSON APIs. It can't handle other types of data, for example application/x-www-form-urlencoded
.
We need to consider adding support of it.
Example of the spec:
export interface paths {
"/token": {
/**
* Login
* @description Login endpoint.
*/
post: operations["login_token_post"];
};
// ...
}
export interface operations {
login_token_post: {
requestBody: {
content: {
"application/x-www-form-urlencoded": components["schemas"]["Body_login_token_post"];
};
};
responses: {
/** @description Successful Response */
200: {
content: {
"application/json": {
[key: string]: string | undefined;
};
};
};
/** @description Validation Error */
422: {
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
// ...
}
export interface components {
schemas: {
/** Body_login_token_post */
Body_login_token_post: {
/** Grant Type */
grant_type?: string | null;
/** Username */
username: string;
/** Password */
password: string;
/**
* Scope
* @default
*/
scope?: string;
/** Client Id */
client_id?: string | null;
/** Client Secret */
client_secret?: string | null;
};
// ...
}
}