All files / types/api _shared.ts

100% Statements 32/32
100% Branches 1/1
100% Functions 1/1
100% Lines 32/32

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 431x 1x 1x   1x 1x 1x           1x 1x 1x 1x 1x 7x 7x 7x 7x 7x   1x 1x 1x   1x 1x 1x 1x 1x 1x 1x   1x 1x 1x   1x 1x 1x  
export const api200Body = {
  message: 'Success',
} as const;
 
export const api302Body = {
  message: 'Found',
} as const;
 
export interface api400Body {
  message: 'Invalid request body';
  errors: string[];
}
export const api400Body: api400Body = {
  message: 'Invalid request body',
  errors: [],
};
export function generateApi400Body(errors: string[]) {
  return {
    ...api400Body,
    errors,
  };
}
 
export const api401Body = {
  message: 'Missing Authentication Token',
} as const;
 
export const api403Body = {
  message: 'Missing Authentication Token',
} as const;
export const api403Response = {
  statusCode: 403,
  body: JSON.stringify(api403Body),
};
 
export const api404Body = {
  message: 'Resource not found',
} as const;
 
export const api500Body = {
  message: 'Internal server error',
} as const;