So now that I've forced you to learn how request bodies work when you're posting something, and I did
that by forcing you to to define a request body as a long string where you have key value separated
by ampersands and so forth, I'll show you an easier way to do it, one that is a little cleaner.
It requires less effort.
But I thought it was important for you to know how to build a post body.
It's important to know how post work and this doing it this way forced you to learn that.
So there is actually an easier way to do it.
And it's done by creating a you are a values type and I'll show you how it works here.
So what I do is create a new variable, which I will call posted data, and that is assign the value
of nothing more than an empty URL values.
So now that I've created that, I can add things to it.
So what I have here is start date and date, first name, last name and so forth.
And all I do is just add values to it.
So I say posted data add and my key for the first one would be start date.
And the value is exactly what we have above 20 50 zero one zero one.
And I do the same thing for end date and I change the date to 2050 01 02 and I do the same thing for
first name, which I make John.
And a last name.
Smith email John at Smith Dotcom Phone, which I make some phone number five five five five five five
five five five and Ramadi, which in this case is one, which means I don't need this request body anymore.
So I can actually comment that a.
And instead of putting a string's new reader request body, which doesn't exist anymore, I just use
posted data and then I call a function built into that called in code.
And now that will work.
And as you can see, this is a much cleaner method of adding things to the posted data or to the data
that you're posting.
And you can actually go and revised all of this test to replace all of these requests bodies with a
new posted data of type you orld values.
And what I'll do is I'll update the test to use this methodology and post the updated source code there.
I warned you very early in the course that I would make you do things the hard way and then show you
an easier way to do it.
But this method actually shows you how posted data is handled by Web Web browsers and Web servers.
So I'll update this and post the updated source code to the course resources for this lecture.