/// <summary> /// Remove record if exists for idempotency /// </summary> /// <returns></returns> private static IEnumerator PrepareForPost() { var yieldInstruction = ObservableUnityWebRequest .HeadAsObservable("http://localhost:3001/fruits/4") .ToYieldInstruction(false); yield return(yieldInstruction); if (!yieldInstruction.HasError) { yield return(ObservableUnityWebRequest .DeleteAsObservable("http://localhost:3001/fruits/4") .ToYieldInstruction(false)); } }
public IEnumerator HttpDeleteAsObservable() { yield return(PrepareForDelete()); var yieldInstruction = ObservableUnityWebRequest .DeleteAsObservable("http://localhost:3001/fruits/3") .ToYieldInstruction(false); yield return(yieldInstruction); var fruit = JsonUtility.FromJson <Fruit>(yieldInstruction.Result); Assert.AreEqual(default(int), fruit.Id); Assert.Null(fruit.Name); Assert.Null(fruit.NameJapanese); }