1
00:00:01,560 --> 00:00:07,200
So now that I've forced you to learn how request bodies work when you're posting something, and I did

2
00:00:07,200 --> 00:00:16,530
that by forcing you to to define a request body as a long string where you have key value separated

3
00:00:16,530 --> 00:00:22,780
by ampersands and so forth, I'll show you an easier way to do it, one that is a little cleaner.

4
00:00:22,830 --> 00:00:24,480
It requires less effort.

5
00:00:24,750 --> 00:00:28,980
But I thought it was important for you to know how to build a post body.

6
00:00:29,400 --> 00:00:34,020
It's important to know how post work and this doing it this way forced you to learn that.

7
00:00:34,440 --> 00:00:36,240
So there is actually an easier way to do it.

8
00:00:36,330 --> 00:00:41,680
And it's done by creating a you are a values type and I'll show you how it works here.

9
00:00:42,390 --> 00:00:49,290
So what I do is create a new variable, which I will call posted data, and that is assign the value

10
00:00:49,290 --> 00:00:52,310
of nothing more than an empty URL values.

11
00:00:53,280 --> 00:00:55,650
So now that I've created that, I can add things to it.

12
00:00:55,980 --> 00:01:00,780
So what I have here is start date and date, first name, last name and so forth.

13
00:01:00,780 --> 00:01:02,420
And all I do is just add values to it.

14
00:01:02,700 --> 00:01:08,130
So I say posted data add and my key for the first one would be start date.

15
00:01:10,800 --> 00:01:16,950
And the value is exactly what we have above 20 50 zero one zero one.

16
00:01:17,740 --> 00:01:27,500
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

17
00:01:27,630 --> 00:01:30,450
first name, which I make John.

18
00:01:33,110 --> 00:01:34,070
And a last name.

19
00:01:38,310 --> 00:01:54,310
Smith email John at Smith Dotcom Phone, which I make some phone number five five five five five five

20
00:01:54,490 --> 00:02:04,140
five five five and Ramadi, which in this case is one, which means I don't need this request body anymore.

21
00:02:04,140 --> 00:02:05,570
So I can actually comment that a.

22
00:02:07,730 --> 00:02:13,060
And instead of putting a string's new reader request body, which doesn't exist anymore, I just use

23
00:02:13,070 --> 00:02:18,530
posted data and then I call a function built into that called in code.

24
00:02:20,180 --> 00:02:21,830
And now that will work.

25
00:02:21,960 --> 00:02:28,670
And as you can see, this is a much cleaner method of adding things to the posted data or to the data

26
00:02:28,670 --> 00:02:29,420
that you're posting.

27
00:02:29,780 --> 00:02:36,830
And you can actually go and revised all of this test to replace all of these requests bodies with a

28
00:02:36,830 --> 00:02:39,530
new posted data of type you orld values.

29
00:02:39,980 --> 00:02:44,710
And what I'll do is I'll update the test to use this methodology and post the updated source code there.

30
00:02:45,260 --> 00:02:49,250
I warned you very early in the course that I would make you do things the hard way and then show you

31
00:02:49,250 --> 00:02:50,360
an easier way to do it.

32
00:02:50,570 --> 00:02:57,340
But this method actually shows you how posted data is handled by Web Web browsers and Web servers.

33
00:02:57,710 --> 00:03:03,680
So I'll update this and post the updated source code to the course resources for this lecture.
