happy-dom icon indicating copy to clipboard operation
happy-dom copied to clipboard

#463@minor: Added partial support for XMLHttpRequest.

Open Mas0nShi opened this issue 2 years ago • 2 comments

Tasks

  • [x] #401

  • [x] #452

  • [x] #508

  • [x] #514

  • [x] #521

  • [x] #522

  • [x] #526

  • [ ] #463

  • URL & URLSearchParams we try to use node:url module solve problems about URL and URLSearchParams now.

  • Document.URL & Document.documentURI I have implemented it in https://github.com/capricorn86/happy-dom/pull/520/commits/a71819f7bd813a3e0bc528f9fa8995a0896f52d7

  • XMLHttpRequest it is still implemented and does not support synchronization.

References: https://github.com/souldreamer/xhr2-cookies https://xhr.spec.whatwg.org/#xmlhttprequesteventtarget https://developer.mozilla.org/en-US/docs/Web/API/Document/URL https://dom.spec.whatwg.org/#dom-document-url https://github.com/jsdom/jsdom

Mas0nShi avatar Jun 25 '22 14:06 Mas0nShi

Hi, @capricorn86, i need you give me some suggestions about https://github.com/capricorn86/happy-dom/issues/521#issuecomment-1166525271_

Mas0nShi avatar Jul 01 '22 05:07 Mas0nShi

Hi, @capricorn86, i need you give me some suggestions about #521 (comment)_

Yes I think that is a good idea 👍 Hopefully it works the same way as in the browser.

capricorn86 avatar Jul 01 '22 09:07 capricorn86

Hi, @daveed07, Sorry, I've been too busy in the past few months. Thank you for your PR! It's looks like good, but there's still a lot of things we need to correct.

Mas0nShi avatar Oct 15 '22 16:10 Mas0nShi

Hi, @daveed07, Sorry, I've been too busy in the past few months. Thank you for your PR! It's looks like good, but there's still a lot of things we need to correct.

Yes I am planning to fix the last stuff as soon as possible 😊

capricorn86 avatar Oct 15 '22 16:10 capricorn86

Hi, @daveed07, Sorry, I've been too busy in the past few months. Thank you for your PR! It's looks like good, but there's still a lot of things we need to correct.

Yes I am planning to fix the last stuff as soon as possible 😊

Couldn't be better! If you have settled anything, please let me know.

Mas0nShi avatar Oct 15 '22 16:10 Mas0nShi

F**k, there's a lot of work to do...

~~redirect location BUGs~~

~~it's broken if redirect change protocol.~~

//  redirect location
// 'http://www.baidu.com' -> 'https://www.baidu.com'
oReq.open("GET", "http://www.baidu.com/", true);
// ...

Fixed:https://github.com/capricorn86/happy-dom/pull/520/commits/d588d3baa7e87b5f6c2bfecf59ea817f1b932bf6

Mas0nShi avatar Oct 16 '22 08:10 Mas0nShi

Hey, @capricorn86, I think we can change sync-request to our sync XMLHttpRequest now. What do you suggest?

Mas0nShi avatar Oct 16 '22 13:10 Mas0nShi

Hey, @capricorn86, I think we can change sync-request to our sync XMLHttpRequest now. What do you suggest?

Yes, I also think so. Extract it to a utility, but it doesn't have to be done as part of this feature.

capricorn86 avatar Oct 18 '22 21:10 capricorn86

F**k, there's a lot of work to do...

~redirect location BUGs~

~it's broken if redirect change protocol.~

//  redirect location
// 'http://www.baidu.com' -> 'https://www.baidu.com'
oReq.open("GET", "http://www.baidu.com/", true);
// ...

Fixed:d588d3b

Yes I know :sweat_smile:

capricorn86 avatar Oct 18 '22 21:10 capricorn86

Hey, @capricorn86. I think our current priority is to add test units. But I failed to implement a local HTTP server, can you help me?

Mas0nShi avatar Oct 22 '22 06:10 Mas0nShi

Hey, @capricorn86. I think our current priority is to add test units. But I failed to implement a local HTTP server, can you help me?

Hi! Yes I will try to find some time tonight :slightly_smiling_face:

capricorn86 avatar Oct 26 '22 20:10 capricorn86

Hey, @capricorn86. I think our current priority is to add test units. But I failed to implement a local HTTP server, can you help me?

Great work on the implementation. It seems like it is very soon ready :slightly_smiling_face:

capricorn86 avatar Oct 26 '22 20:10 capricorn86

Great work on the implementation. It seems like it is very soon ready 🙂

I have a question, when we use a synchronous request and use a child process to get the response, how do we mock it? All I can think of is getting a real http & https server in local...

Mas0nShi avatar Oct 27 '22 02:10 Mas0nShi

Great work on the implementation. It seems like it is very soon ready 🙂

I have a question, when we use a synchronous request and use a child process to get the response, how do we mock it? All I can think of is getting a real http & https server in local...

I started on adding mocking capabilities in setup.js yesterday. Will soon continue on actual tests.

davidortner-ipex avatar Oct 27 '22 11:10 davidortner-ipex

I started on adding mocking capabilities in setup.js yesterday. Will soon continue on actual tests.

okey, I'm looking forward to it. 😄

Mas0nShi avatar Oct 27 '22 11:10 Mas0nShi

@Mas0nShi I have managed to mock the Node.js packages and started to add some unit tests. I will continue as soon as I have some more time.

capricorn86 avatar Nov 14 '22 17:11 capricorn86

Is there any help I can provide to get this across the finish line? Mainly looking for the URL changes so I can do some web worker tests with vitest.

kalvenschraut avatar Dec 06 '22 18:12 kalvenschraut

Is there any help I can provide to get this across the finish line? Mainly looking for the URL changes so I can do some web worker tests with vitest.

Hi @kalvenschraut!

It's a complicated feature, sorry that it takes such a long time.

It is starting to reach the end. It is just some more unit tests that has to be added to make sure that it is stable and will remain so.

capricorn86 avatar Dec 06 '22 23:12 capricorn86

@Mas0nShi I felt confident enough to merge this pull request now. Normally I would have liked if you got some more time to review, but many are waiting for it and there are many unit tests covering this. Feel free to review the code and check if something is missing 🙂

capricorn86 avatar Dec 07 '22 15:12 capricorn86

@kalvenschraut it has been merged now 🙂

capricorn86 avatar Dec 07 '22 15:12 capricorn86