2021-07-08 11:38:41 -04:00
|
|
|
import ApplicationSerializer from './application';
|
|
|
|
|
|
2022-06-28 19:30:26 -04:00
|
|
|
export default class CredentialLibrarySerializer extends ApplicationSerializer {
|
2022-09-20 18:24:18 -04:00
|
|
|
// =properties
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
*/
|
|
|
|
|
serializeScopeID = false;
|
|
|
|
|
|
2022-06-28 19:30:26 -04:00
|
|
|
/**
|
|
|
|
|
* @override
|
|
|
|
|
* @method serialize
|
|
|
|
|
* @param {Snapshot} snapshot
|
|
|
|
|
*/
|
|
|
|
|
serialize() {
|
|
|
|
|
const serialized = super.serialize(...arguments);
|
|
|
|
|
if (serialized.attributes) {
|
|
|
|
|
// Serialize `http_request_body` only if `http_method` is POST
|
|
|
|
|
if (!serialized.attributes?.http_method?.match(/post/i))
|
|
|
|
|
delete serialized.attributes.http_request_body;
|
|
|
|
|
}
|
|
|
|
|
return serialized;
|
|
|
|
|
}
|
|
|
|
|
}
|