fix(approval): повторная отправка на согласование не падает на удалении старого маршрута
recycle() слал POST без Content-Type с пустым odata-version — SPFx (jsonRequest) сам бросал «requires the OData-Version header to be 3.0 or 4.0» до запроса. writeRoute общий: повторная отправка после доработки/перезапуска ломалась во всех трёх формах; в КПС тот же recycle.
This commit is contained in:
@@ -256,8 +256,14 @@ export class KpsCtFormService {
|
|||||||
// Мягкое удаление (то же, что кнопка «Удалить» в UI). Работает на «защищённых» списках,
|
// Мягкое удаление (то же, что кнопка «Удалить» в UI). Работает на «защищённых» списках,
|
||||||
// где DELETE/MERGE падают с E_FAIL (§6). Для «обновления» такой записи: recycle() + повторный POST.
|
// где DELETE/MERGE падают с E_FAIL (§6). Для «обновления» такой записи: recycle() + повторный POST.
|
||||||
public async recycleListItem(listName: string, id: number): Promise<void> {
|
public async recycleListItem(listName: string, id: number): Promise<void> {
|
||||||
|
// Content-Type обязателен даже без тела: у POST с пустым odata-version SPFx иначе сам бросает
|
||||||
|
// «jsonRequest is enabled, which requires the OData-Version header…».
|
||||||
const options: ISPHttpClientOptions = {
|
const options: ISPHttpClientOptions = {
|
||||||
headers: { Accept: 'application/json;odata=nometadata', 'odata-version': '' }
|
headers: {
|
||||||
|
Accept: 'application/json;odata=nometadata',
|
||||||
|
'Content-Type': 'application/json;odata=nometadata',
|
||||||
|
'odata-version': ''
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const res = await this.spHttpClient.post(
|
const res = await this.spHttpClient.post(
|
||||||
`${this._liById(listName, id)}/recycle()`,
|
`${this._liById(listName, id)}/recycle()`,
|
||||||
|
|||||||
@@ -108,8 +108,14 @@ export class ApprovalListService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async recycleListItem(id: number): Promise<void> {
|
private async recycleListItem(id: number): Promise<void> {
|
||||||
|
// Content-Type обязателен даже без тела: у POST с пустым odata-version SPFx иначе сам бросает
|
||||||
|
// «jsonRequest is enabled, which requires the OData-Version header…» — повторная отправка падала.
|
||||||
const options: ISPHttpClientOptions = {
|
const options: ISPHttpClientOptions = {
|
||||||
headers: { Accept: 'application/json;odata=nometadata', 'odata-version': '' }
|
headers: {
|
||||||
|
Accept: 'application/json;odata=nometadata',
|
||||||
|
'Content-Type': 'application/json;odata=nometadata',
|
||||||
|
'odata-version': ''
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const res = await this.spHttpClient.post(
|
const res = await this.spHttpClient.post(
|
||||||
`${this._liById(this.listTitle, id)}/recycle()`,
|
`${this._liById(this.listTitle, id)}/recycle()`,
|
||||||
|
|||||||
Reference in New Issue
Block a user