Can someone elaborate on exactly what is being asked?

2310 views java
9

We're setting up a basic http web server using node. We're coding in Java Script if this helps. I don't understand exactly what is being asked of us. Windows using Gitbash.

"Return the file to the user by setting the correct Content-Type for the file and writing it to the response"

That is word for word what is asked in the lab.

If someone could explain I'd appreciate it.

answered question

It would be helpful to understand more about what you are actually doing. For example, what OS? What web server? And what Java frameworks?

1 Answer

1

Whenever someone makes a request to a server, the server answers the request with a header and a body. The body usually contains the data you see on the browser and the header contains information about the type of content the server is returning.

When the server returns a file, it has to set this information on the header, otherwise the browser would expect the content to be just text. This information on the header that describes the content is called Content-Type.

As pointed out by Elliott Frisch, this web page contains a list of the suported mime types that your server should be returning: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types

posted this

Have an answer?

JD

Please login first before posting an answer.