private HttpContent GetContent(SerializerResolver serializer) { switch (BodyType) { case BodyType.Encoded: return(new FormUrlEncodedContent(ParameterUtils.GetParameter <FormParameter>(this, RequestCulture))); case BodyType.Serialized: return(serializer.Resolve(GetType(), DataDirection.Out).Serialize(this)); case BodyType.SerializedProperty: var body = serializer.Resolve(GetType(), DataDirection.Out).Serialize(ParameterUtils.GetSingleParameterObject <RequestBody>(this)); return(body); case BodyType.Custom: return(BodyContent); default: //todo custom exception - there should have been a datatype specified throw new ArgumentOutOfRangeException(); } }